One of the great features of c# is you can declare a property.
Expand|Select|Wrap|Line Numbers
- public class Student
- {
- public Guid Id { get; }=Guid.NewGuid();
- }
In the previous version of c# we not able to write a property only with get.
https://imgur.com/AudqH3t
Above image shows it will give an error in c# version 5.0 and below but if you declared read-only property in c# it will not throw an error. Below is the image of version 6.0
https://imgur.com/ZtQdhGM