C# 6.0 lets the developers use the lambda expression to implement the getter value of the read-only property .
Whenever a lambda expression is found , the C# compiler identifies it as the property with only get method rather than a field.
Lambdas Expression for Getter-Only Auto-Properties in C# 6.0
Below is a sample code snippet demonstrating the use of Lambdas Expression for Getter-Only Auto-Properties in C# 6.0
public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public string FullName => new string ((FirstName + " " + LastName).ToArray()); }
Leave a Reply