Why am I allowed to return null within a method declaration, which could also return a value type?
I thought interfaces such as IList<T> have no restriction on the type of their implementation.
Further, how would one check if a method returning a IList<T> returned the default value?
public IList<int> SomeMethod()
{
// Allowed
return new MyStructList();
// Allowed
return null;
}
public struct MyStructList : IList<int>
{
...
}