I might get some downvotes here, but I actually found conflicting information in a regular search and would like to get a definitive answer that other people can also easily find.
Given a property in current C #:
public static IEnumerable<string> foo { get; set; } = new string[] { "bar", "bar2" };
We know that the default value foowill be returned as the above array. If a different value is assigned, the default value is no longer used. However, if so:
public static IEnumerable<string> foo { get; set; } = GetMyStrings();
My thought is that these are functions:
if(foo == null) { foo = GetMyStrings();}
and that foo will save the value from the first run GetMyStrings()for the lifetime of the object, unless overwritten by the manually assigned value.
, GC GetMyStrings() , "" GetMyStrings() .
?