79386793

Date: 2025-01-25 13:31:07
Score: 2.5
Natty:
Report link

I guess my example can be boiled down to this:

class A1
{
    public void F1<T>(T t) where T : struct { throw new NotImplementedException(); }
    public void F1<T>(T t) where T : class { throw new NotImplementedException(); }

}

and the core question would be why doesn't compiler treat generic for structs and generic for class as different param types. I guess there is no logical explanation, it just doesn't. or am I missing something?

Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Aliq Qim