I tried creating a validator which checks for default values on the enumerations and raises errors if they are set to the default undefined value.
I had a generic function in which I needed to check item == default(T). the compiler didnt like the simpler form saying “cannot compare ‘T’ to ‘T’”. I found the solution online and created the simpler function..
public static bool IsDefault<T>(T item)
return EqualityComparer<T>.Default.Equals(item, default(T));