by syspec · 5y ago · 0 comments
Person p1 = new();
Person p2 = new("Tom");
Person p3 = new() { FirstName = "Tom" }; 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.