3 ms·
In my opinion it's more useful when declaring class members, e.g.: public class SignPost { public List<string> Messages { get; set;} = new(); private
by twodave 6y ago
In my opinion it's more useful when declaring class members, e.g.:
public class SignPost {
public List<string> Messages { get; set;} = new();
private List<string> Errors = new();
}
In both of the above usages var is not allowed. Often-times instead of a simple list you have something like an IReadOnlyCollection<T> or an equally-abominable custom type that is just a pain to write out 2x for every time you add it as a dependency somewhere.