0

The compilers tells me that the following two methods have the same signature:

internal static void Foo<T>(T? output) where T : class
{}
internal static void Foo<T>(T output) where T : struct
{}

But whis is this the case? In the first method, the parameter allows for nullable reference types and in the second we only allow for value types. Or to state the question differently, why is T? and T the same in this case?

AILogic
  • 25
  • 3

1 Answers1

0

Generic constraints are not a part of method signature in the C#/CLR. There are some discussions about this in the C# language repo.

Guru Stron
  • 102,774
  • 10
  • 95
  • 132