object vs dynamic vs var in C#
January 16, 2016 by pramod thakur in C#, Interview Question
Object
Dynamic
Var
- It can store any kind of value but it is mandatory to initialize at time of declaration.
var obj=10;
- var is type safety.
- Can’t initialize with null
- Can’t pass as method parameter and can not have return type as well
- Casting is not required.
Like this:
Like Loading...
Related
Tags: dynamic vs var in C#, object vs dynamic in C#, object vs dynamic vs var in C#, object vs var in C#