Object
|
Dynamic
|
Var
|
Can able to store any kind of value, because object is the base class of all type in .net framework.
|
Can able to store any type of the variable, similar to old VB language variable.
| |
Compiler has little information about the type
|
Compiler doesn't have any information about the this type of variable.
|
It's compiler safe i.e compiler has all information about the stored value, so that it doesn't cause any issue at run-time.
|
Object type can be passed as function argument and function also can return object type
|
Dynamic type can be passed as function argument and function also can return object type
| |
Require to cast object variable to original type before using it. So this assigning to object type and converting to original type called as Boxing and Un-Boxing for value type and for the reference type its casting of types. It's actually increasing the overhead when we do this both operation.
Allows to perform operation of given type once it get cast any user defined or primitive data type. |
Casting is not require but you need to know the property and methods related to stored type
|
No need to cast because compiler has all information to perform operation.
|
Doesn't cause problem because compiler has all info about stored value.
| ||
Useful when doesn't have more information about the data type.
|
Useful when coding using reflection or dynamic language support or with the COM objects, because we require to write less amount of code.
|
Useful when getting result out of the linq queries. In 3.5 framework it introduce to support linq feature.
|
Solution for the QlikView, Biztalk, DotNet and MSBI real time development problems
Search This Blog
Wednesday, November 13, 2013
Difference between Object, Dynamic and Var in c#
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Qlikview developer, Designer and admin interview questions (Qlikview developer, Designer and admin FAQ’S) 1. Difference between Set ...
-
.Net Integration with Bill Desk Payment Gateway Introduction: Now-a-days online shopping websites has become very popular, and to h...
-
What is "Big Data"? The short answer is that size does matter after all. Sometimes big data is measured in terabytes, petabytes...
-
BizTalk Developer Interview Questions and Answers : Schema 1. What is the purpose of a document schema? The schema is basically a contr...
-
Major difference between WCF SOAP and WCF REST is flexibility. WCF SOAP services supports a wide range of transport protocols, including...
No comments:
Post a Comment