I come across the following example:
public class TimeService
{
public TimeService()
{
Time = DateTime.Now.ToLongTimeString();
}
public string Time { get; }
}
We have properties for which, e.g., the following is an example of initializing with empty string:
public string StringProperty { get; set; } = "";, but how does the Time from TimeService work if getter properties cannot be assigned values directly?
Maybe, I haven't formulate my question properly when browsing, but I haven't found the appropriate answer yet.