|
Object |
Dynamic |
Var |
|
It can store any kind of value because object is a base class of all type in .net framework. object obj; |
It can store any kind of value. dynamic obj; |
It can store any kind of value but it is mandatory to initialize at time of declaration. var obj=10; |
|
object is not type safety |
dynamic is not type safety |
var is type safety |
|
object is initialize with null |
dynamic is initialize with null |
Can’t initialize with null |
|
object type can be passed as method parameter and also can return object type. public object Method2(object param) { object objResponse = param; return objResponse; } |
dynamic type can be passed as method parameter and also can return dynamic type. public dynamic Method2(dynamic param) { dynamic objResponse = param; return objResponse; } |
Can’t pass as method parameter and can not have return type as well |
|
Casting required |
Casting is not require but you need to know the property and methods related to stored type |
Casting is not require |
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Pramod ThakurPosted Sep 20, 2016, 3:44 AM
Thanks Subash
Pramod ThakurPosted Sep 20, 2016, 3:44 AM
Thanks Gowtham Rajamanickam
Pramod ThakurPosted Sep 20, 2016, 3:43 AM
Thanks Shubham Kumar
Pramod ThakurPosted Sep 20, 2016, 3:42 AM
Thanks @sthitaprajnya
Pramod ThakurPosted Sep 20, 2016, 3:41 AM
Thanks Kiran Thakur
SubashPosted Sep 19, 2016, 7:44 AM
Very nice sir
Gowtham RajamanickamPosted Apr 8, 2016, 10:00 AM
good one..
Shubham KumarPosted Jan 21, 2016, 3:59 AM
nice quick comparession
Sthitaprajnya Debasis NayakPosted Jan 16, 2016, 7:26 AM
Nice...
Kiran ThakurPosted Jan 16, 2016, 5:32 AM
Thanks for nice share