Skip to content
Static interface to dynamic implementation (duck casting). Uses the DLR combined with Reflect.Emit.
Branch: master
Clone or download
jbtule Merge pull request #34 from NickAcPT/patch-1
Fix super small spelling mistake on README
Latest commit 3802820 Apr 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci Fix CI Build and update Dynamitey Dep Apr 5, 2018
ImpromptuInterface Fix CI Build and update Dynamitey Dep Apr 5, 2018
Tests Fix CI Build and update Dynamitey Dep Apr 5, 2018
graphics Strip deprecated code Aug 16, 2017
.appveyor.yml fixed environ issue Apr 5, 2018
.gitattributes Fixed line endings and added git ingore Aug 27, 2012
.gitignore remove empty properties folder Mar 24, 2018
.travis.yml change travis config Mar 20, 2018
ImpromptuInterface.sln.DotSettings Upgrade projects for VS12 Oct 9, 2012
License.txt Moved files around, removed mecurial files Aug 27, 2012
NuGet.config Added missing package source Aug 17, 2017 Fix super small spelling mistake on README Apr 6, 2019
Version.props ci:another attempt at fixing auto versioning Apr 5, 2018

net4.0/netstd2.0 framework to allow you to wrap any object (static or dynamic) with a static interface even though it didn't inherit from it. It does this by emitting cached dynamic binding code inside a proxy.

ImpromptuInterface is available Nuget NuGet

You can find the latest bleed edge on MyGet MyGet Pre Release

Platform Status
Windows Build status
Mac Build Status
Linux Build Status

Some of the features of ImpromptuInterface have been moved into another library called Dynamitey, ImpromptuInterface depends on Dynamitey.

ImpromptuInterface.FSharp has been spun off into FSharp.Interop.Dynamic and also depends on Dynamitey.

ImpromptuInterface.MVVM has been spun off into it's own repo ImpromptuInterface.MVVM and only receives maitenance updates.

Quick Usage:

    using ImpromptuInterface;
    using Dynamitey;

    public interface IMyInterface{

       string Prop1 { get;  }

        long Prop2 { get; }

        Guid Prop3 { get; }

        bool Meth1(int x);
   //Anonymous Class
    var anon = new {
             Prop1 = "Test",
             Prop2 = 42L,
             Prop3 = Guid.NewGuid(),
             Meth1 = Return<bool>.Arguments<int>(it => it > 5)

    var myInterface = anon.ActLike<IMyInterface>();


   //Dynamic Expando object
    dynamic expando = new ExpandoObject();
    expando.Prop1 ="Test";
    expando.Prop2 = 42L;
    expando.Prop3 = Guid.NewGuid();
    expando.Meth1 = Return<bool>.Arguments<int>(it => it > 5);
    IMyInterface myInterface = Impromptu.ActLike(expando);
You can’t perform that action at this time.