I have some generic method
T SomeMethod(Func<T> func){
T result = func();
if (result != null)
{ //.....}
}
It works good if T is class. But what should I do if T is struct? How can I check if result == default(T) in case if T is struct?
P.S. I don't want to use the constraint where T: class or Nullable types.
null? What if a reference type has just been constructed - is that equivalent? I think this can't be answered generically, but must be answered on a case-by-case basis depending on your scenario.default(T) where T : class == nullif(result != null).