What's the difference between these two ways to add something?
private string abc => "def";
And
private string abc = "def";
What's the difference between these two ways to add something?
private string abc => "def";
And
private string abc = "def";
This is the declaration of a classic field as it has always existed in C#:
private string abc = "def";
The field is immediately assigned an initial value.
This is a shorthand syntax for declaring a getter-only property (or expression-bodied property), introduced in C# 6:
private string abc => "def";
It's a short way to write the following:
private string abc
{
get { return "def"; }
}