Why can’t the operator ‘==’ be applied to a struct and default(struct)?
For classes, the == operator uses reference equality. Of course, structs are value types, so they can’t be compared by reference. There is no default implementation of == for structs because memberwise comparison isn’t always a valid comparison, depending on the type. You can instead use the Object.Equals method, which does compare memberwise: Console.WriteLine(user.Equals(default(User)) ? … Read more