In “CLR via C#” book it’s mentioned that dynamic keyword corresponding FCL type is System.Object. please clarify this .
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
It’s not the same thing from the C#’s point of view at all… but in the compiled code, a variable declared as type
dynamicwill usually (possibly always) correspond with a CLR field or local variable of typeobject.The C# compiler is responsible for making sure that any source code using that value has the dynamic behaviour applied to it.
objectis simply the compiler the representation uses for storage. It also applies the[Dynamic]attribute where appropriate, so that other code knows it’s to be treated dynamically.For example, consider this:
I believe that will be compiled into IL equivalent to:
now if you write:
the compiler uses the attribute to know that
foo.someFieldis dynamic, so theLengthproperty should be dynamically bound.