What’s in a name? (C#’s hidden support for structural typing)
togaroga.com
What’s in a name? (C#’s hidden support for structural typing)
1–8 of 8 posts
Re: What’s in a name? (C#’s hidden support for structural typing)
#2AOP weavers like postsharp let you do some duck typing like stuff by injecting interfaces as post compile step.
Re: What’s in a name? (C#’s hidden support for structural typing)
#3How can I use this structural typing feature? AOP weavers like postsharp let you do some duck typing like stuff by injecting interfaces as post compile step.
Re: What’s in a name? (C#’s hidden support for structural typing)
#4How can I use this structural typing feature? AOP weavers like postsharp let you do some duck typing like stuff by injecting interfaces as post compile step.
Actually Linq + Reflection is some of the most entertaining code to write C#. Example: http://github.com/ecoffey/Bebop/blob/master/Bebop/BebopAppli...
we're saying there "Give me all the types out of a specific assembly that implement IResource".
Re: What’s in a name? (C#’s hidden support for structural typing)
#5Re: What’s in a name? (C#’s hidden support for structural typing)
#6Edit: 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.
Re: What’s in a name? (C#’s hidden support for structural typing)
#7Re: What’s in a name? (C#’s hidden support for structural typing)
#8I always found this somewhat inelegant. I suppose given all the constraints, its OK, but it feels like such a feature (such as the collection initializers) should be based on language constructs, not compiler special cases.