.NET interview questions with answers: - What is the difference between Reflection and Dynamic?
- By Shiv Prasad Koirala in .Net
- May 15th, 2013
- 14897
- 0
- 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.
Recently one of our friends was asked a c# design pattern interview question :- Difference between DI vs IOC ? check the same from http://dotnetinter.livejournal.com/68566.html
You can also see our .Net and ASP.NET interview questions with answers videos from http://www.questpond.com
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more