Thursday, April 15, 2021

C# Puzzle No.24 (intermediate)

Given a generic interface definition
public interface IDoSomething : IDisposable { }
please explain why this is possible
class DoesSomething<String> : IDoSomething<String>
{
    public void Dispose()
    {
    }
}
and this is not possible (doesn't compile)
class DoesSomething<string> : IDoSomething<string>
{
    public void Dispose()
    {
    }
}
An explanation can be found here.

No comments: