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 7623563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:44:16+00:00 2026-05-31T04:44:16+00:00

In C#, please does anyone know why I can’t do the following? (specifically the

  • 0

In C#, please does anyone know why I can’t do the following? (specifically the line marked ‘NOT fine!’ below)

interface A
{
    void Add(dynamic entity);
}

interface B : A {}

class C : B
{
    public void Add(dynamic entity)
    {
        System.Console.WriteLine(entity);
    }
}

class Program
{
    static void Main(string[] args)
    {
        B b = new C();
        dynamic x = 23;
        b.Add(23);        // fine
        b.Add((int)x);    // fine
        (b as A).Add(x);  // fine
        //b.Add(x);       // NOT fine!
    }
}

I have absolutely no problems if the call isn’t dynamically-bound, or if I explicitly cast to the interface at the root of the hierarchy, but the dynamically-bound call gives me:

Unhandled Exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: No overload for method 'Add' takes '1' arguments
   at CallSite.Target(Closure , CallSite , B , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
   at Program.Main(String[] args) in C:\Users\Stuart\Documents\Visual Studio 2010\Projects\CSharp Testbed\Program.cs:line 218
  • 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-31T04:44:17+00:00Added an answer on May 31, 2026 at 4:44 am

    Looking on Microsoft Connect it’s filed as a bug – Dynamic runtime fails to find method from a base interface during runtime

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

Sidebar

Related Questions

It does not matter what programming language. Can anyone please give me an idea
Does GWT has LazyPanel .I can not see it .Please let me know .If
Does anyone know of or can anyone please produce a simple example of Django's
What does it mean by logical grouping of modules in assembly? Can anyone please
can you please help me with this issue the String class does not have
Can someone please explain what the & does in the following: class TEST {
What does TEMP0_FILES below compute to? SOURCE_FILES can equal to multiple source files. Please
Does anyone know where I can find a downloadable copy of CAT.Net 2.0 (beta
Does anyone know where I can find an implementation of an algorithm to convert
Does anyone know how I can expand on the function at the moment, so

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.