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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:07:21+00:00 2026-06-10T12:07:21+00:00

I have use the type dynamic, a new type in .NET 4.0. I want

  • 0

I have use the type dynamic, a new type in .NET 4.0.

I want to use a dynamic type because I want to use some types that in advance I don’t know what type is, but I know that all this possible type has some common methods.

In my case, I am using self tracking entities in entity framework 4.0, and I know that all the entities has the methods markedXXX (to set the state of the entity).

Through the dynamic object that I created, I can access and set the properties of one of this entities, but when I try to execute the MarkedAsXXX method I get an exception that says that the object has not definied the method.

I would like to know how to access to this methods. Is it possible?

Because I have a function that can access to the original values and set this values to the current one, but I need to set the entity as Unchenged.

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-06-10T12:07:23+00:00Added an answer on June 10, 2026 at 12:07 pm

    I want to use a dynamic type because I want to use some types that in advance I don’t know what type is, but I know that all this possible type has some common methods.

    That suggests you should create an interface with those common methods, and make all the relevant types implement the interface.

    Through the dynamic object that I created, I can access and set the properties of one of this entities, but when I try to execute the MarkedAsXXX method I get an exception that says that the object has not defined the method.

    It’s possible that this is due to explicit interface implementation. If the types have those methods declared as public methods in the normal way, it should be fine.

    If you really want to use dynamic typing with these types, is there some base interface which declares the MarkedAsXXX methods, which you could cast the objects to before calling those methods? (I’m not familiar with the entity framework, so I don’t know the details of those methods.)

    Basically, I would try to avoid dynamic typing unless you really need it, partly because of edge cases like this – but if explicit interface implementation is the cause, then casting to that interface should be fine.

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

Sidebar

Related Questions

I have a list that holds objects of type dynamic. When I use the
I have some dynamic int * arrays that I would like to use as
I have a vb.net (I am new to vb.net) site that is supporting 10
I'm new to ASP.NET, but I've seen a lot of tutorials and even have
I have a Delphi DLL that contains the following types: type TStepModeType = (smSingle,
I'm new with Core Data and there are some issues that I don't understand
I have a product admin web site that has been generated using ASP.NET Dynamic
i have to use the following function, to change the input's type <input class=input
I have following webservice: [webmethod] public string MakeReservation(?? PassengersInfo)//what data type use for PassengerInfo
I have to type rvm use ruby-1.9.3 every time I login to my server.

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.