Pseudo duck-typing for .NET applications.
Call Duck.Cast<TFrom,TTo>(TFrom) to convert an object to type TTo provided that:
TTois a public interfaceTFromis a public type (possibly a way to get around that, will update if that happens)TFromimplements all properties and method ofTTopublicly and non-statically.
When you call Duck.Cast, a new type is emitted via reflection that extends the target type.
This type directly wraps the initial type's methods and properties, provided that said type
implements all members of the interface.
If a wrapper type has already been generated for a type, DuckNET will opt to use the previously generated wrapper type, rather than emitting a new one.