I am from Java springboot world and recently started learning C# 10 (.NET 6) for one of our clients requirement, initially I was facing a lot of pain understanding fundaments of C# 10, but now I am little comfortable, however I am not able to find good documentation, blogs or questions which provides comparison between similar features and some useful example.
I am currently trying to understand the difference between below, please also check if below is valid ?
public class Employee {
public int Id {get;};
public string Dept {get; set;};
public string FirstName {get; readonly set;};
public string LastName {get; private set;};
public string DateOfJoining {get; init;};
}
This is my guess, please review and help me understanding
public class Employee {
public int Id {get;}; // hardcoded must be defined at the design time and can never change?
public string Dept {get; set;}; //mutable - can be modified multiple times?
public string FirstName {get; readonly set;}; // NOT SURE
public string LastName {get; private set;}; // NOT SURE
public string DateOfJoining {get; init;}; //immutable - can be set only once from constructor?
}