C# Default values for getter-only properties
This feature allows us to set default values for the getters. The getter-only property is read-only property. We can't set a new value to this property.
Compiler reports an error: cannot be assigned at compile time, if we assign value explicitly.
C# Default value for getter-only property Example 1
Rahul kumar firstname.lastname@example.org
Let's see an example, what happen if we assign value explicitly.
C# Default value for getter-only property Example 2
error CS0200: Property or indexer 'Student.Name' cannot be assigned to -- it is read only