I have a beginner question about propperties and fields in c#. I have declared some variables like this:private long _id;public long Id => _id;public string Name { get; set; }public string CategoryName { get; set; }private DateTime _lastEdit;public DateTime LastEdit => _lastEdit;private long _ownerId;public long OwnerId => _ownerId;private string _projectName;public string ProjectName => _projectName;private string _productMetaDataName;public string ProductMetaDataName => _productMetaDataName;private Dictionary<string, string> _fields;public Dictionary<string, string> Fields => _fields;Only the Name and CategoryName should be editable from outside of the class. Is this the way to go or is it better to use the auto get set for all propperties. Like:public long Id{ get; private set; }public string Name { get; set; }public string CategoryName { get; set; }public DateTime LastEdit { get; private set; }public long OwnerId { get; private set; }public string ProjectName { get; private set; }public string ProductMetaDataName { get; private set; }public Dictionary<string, string> { get; private set; }
Beginner about fields propperties and auto get set c#
c#;properties