What is the difference between this:
void MyMethod(IMyInterface value)
{
//...
}
and this:
void MyMethod(T val
Another subtle difference is that you can't overload a method only on constraints (constraints aren't part of the signature of the method):
This is illegal:
void MyMethod(T value) where T : IMyInterface
{
//...
}
void MyMethod(T value) where T : IMyInterface2
{
//...
}
while this is legal:
void MyMethod(IMyInterface value)
{
//...
}
void MyMethod(IMyInterface2 value)
{
//...
}