Program to load data using Expression-Bodied Property in C#

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 1151
The below program will do so -

public class Person
{
//Kindly note that the PersonName has been populated by using expression-bodied property of C#6.0
public List<string> PersonName => new List<string>
{
"Rajlakshmi Biswas",
"Niladri Biswas",
"Arina Biswas",
"RNA Team",
"Mahesh Nagar",
"Manish Nagar",
"Shan Mani",
"Ghanshaym rama"

};
}


Kindly notice the way the string values has been set to the PersonName property using the Expression-Bodied Property(=>) of C# 6.0. It's the Lambda way.

Comments or Responses

Login to post response