|
|
|
What’s in a name? (C#’s hidden support for structural typing)
(togaroga.com)
|
|
23 points
by andrewhare
5890 days ago
|
|
C# is well known for its nominative type system. This means that C# identifies types and their relationships based on their names. That is why C# does not allow you to create two types with the same name, even if they have a different public interface – the C# compiler only cares about the name of the type. |
|
Edit: hm.. but I note that this doesn't work for the using(){} construct.
This requires the object to implement an interface that is convertable to IDisposable instead of just looking for a `Dispose` method.