top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between reflection and dynamic?

+2 votes
280 views
What is the difference between reflection and dynamic?
posted May 29, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

enter image description here
Both reflection and dynamic are used when we want to operate on an object during runtime.

Reflection is used to inspect meta-data of an object. It also has the ability to invoke members of an object on runtime.

Dynamic is a keyword which was introduced in .NET 4.0. It evaluates object calls during runtime. So until the method calls are made compiler is least bothered if those methods / properties etc exist or not.

Dynamic uses reflection internally. It caches the method calls made thus improving performance to a certain extent.

Reflection can invoke both public and private members of an object while dynamic can only invoke public members.

Below is the detail comparison sheet of the same.

enter image description here

answer Jun 29, 2017 by Manikandan J
...