Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:08:10+00:00 2026-05-23T20:08:10+00:00

Can I define a class which derives from DynamicObject and supports an interface (ICanDoManyThings)

  • 0

Can I define a class which derives from DynamicObject and supports an interface (ICanDoManyThings) without having to implement each method in the interface?

I’m trying to make a dynamic proxy object, and want the method invocations on this class to be handled by the implementation of MyProxyClass.TryInvokeMember, which may or may not pass them on to a wrapped object.

Is this possible?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:08:11+00:00Added an answer on May 23, 2026 at 8:08 pm

    ImpromptuInterface does exactly this and it works with ANY IDynamicMetaObjectProvider including DynamicObject subclasses and ExpandoObject.

    using ImpromptuInterface;
    using ImpromptuInterface.Dynamic;
    
    public interface IMyInterface{
    
       string Prop1 { get;  }
    
        long Prop2 { get; }
    
        Guid Prop3 { get; }
    
        bool Meth1(int x);
    }
    

    …

    //Dynamic Expando object
    dynamic tNew = Build<ExpandoObject>.NewObject(
             Prop1: "Test",
             Prop2: 42L,
             Prop3: Guid.NewGuid(),
             Meth1: Return<bool>.Arguments<int>(it => it > 5)
    );
    
    IMyInterface tActsLike = Impromptu.ActLike<IMyInterface>(tNew);
    

    Linfu won’t actually use DLR based objects and rather uses it’s own naive late binding which gives it a SERIOUS performance cost. Clay does use the dlr but you have to stick with Clay objects which are designed for you to inject all behavior into a ClayObject which isn’t always straightforward.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If an interface inherits IEquatable the implementing class can define the behavior of the
I'm stuck. I'm trying to dynamically define a class method and I can't wrap
I have a class (for logging) which derives from std::ostream. Stripped down, it looks
I'm having a templated function that uses a local class which is derived from
I'd like to define a class which is derived from System.Data.DataTable. This class has
Now I research OOP-part of Scheme. I can define class in Scheme like this:
In Java you can define generic class that accepts only types that extend a
I can define default value in domain by this way : class ProcessingPriority {
I know that one can define an 'expected' exception in JUnit, doing: @Test(expect=MyException.class) public
I have a base class which needs to define an enumeration: BaseClass - SomeEnum

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.