Skip to content

MonkeManII/DuckNET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DuckNET

Pseudo duck-typing for .NET applications.

Usage

Call Duck.Cast<TFrom,TTo>(TFrom) to convert an object to type TTo provided that:

  • TTo is a public interface
  • TFrom is a public type (possibly a way to get around that, will update if that happens)
  • TFrom implements all properties and method of TTo publicly and non-statically.

How it Works

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.

About

Psuedo duck-typing for C# interfaces

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages