ekonbenefits / impromptu-interface

Static interface to dynamic implementation (duck casting). Uses the DLR combined with Reflect.Emit.
Apache License 2.0
656 stars 67 forks source link

Generic Function doesn't want to be duck-casted. #4

Open jbtule opened 11 years ago

jbtule commented 11 years ago

Reported by theajp01, Aug 27, 2012 What steps will reproduce the problem?

I don't know if it's supposed to work but I though it'd mention it.

  1. create an interface to duck-cast to: public class Thing {}

public interface ITest { List GetThings (Guid test) where T: Thing; }

  1. make a dynamic object to duckcast. public class OtherThing : DynamicObject { }
  2. duck-cast it. dynamic ot = new OtherThing(); ITest test = Impromptu.ActLike();

test.GetThings(Guid.Empty);

What is the expected output? What do you see instead?

I'd expect test to be of Type ITest.

Instead of that I Get a MissingMemberException.

What version of the product are you using? On what operating system?

Last version

Please provide any additional information below.

I love your work on ImpromptuInterface an awsome tool :)

Oct 16, 2012 comment remilavoie Your OtherThing class needs to have the List GetThings(Guid test) function in order to act like an ITest.