Realize: What is an item, var and dynamic keywords in C#.Net? What are the contrasts between them?
Object
It is a sort which is base of the considerable number of types and perhaps the most established element of the language. It implies estimations of any sorts can be put away in an object type variable. In any case, type change (un-boxing) is required to get a unique sort when the estimation of the variable is recovered so as to utilize it.
So it is an additional overhead of un-boxing. Hence object type should possibly be liked on the off chance that we have no more data about the information type.
Object o;
o = 10;
The compiler has title data of item type.
Var
This was presented in .net 3.5 system. This likewise can have any kind of qualities like article however it is must instate the incentive at the time of announcement of the variable. The keyword is most appropriate for LINQ questions in C#.
Var a = 10; Var b = "string value"; Var c = new Product(); // object of product type Var d;//Error, as the value is not assigned at time of declaration of variable d d = 10;
Dynamic
This keyword was presented in .net 4.0 structure. This additionally can be utilized to store any sort of significant worth like article and var yet not at all like item un-boxing isn’t required at time of utilizing the variable.
Dynamic d1 = 10; Dynamic d2; D2=new Product(); Dynamic d3="string value";
Compiler has no data of dynamic kind yet esteem is assessed at run time.