+ 4
You can assign values of any type to var but after you have declared it you can't change the type. var a = "string"; a = 9 //Error. You cant store integers to string type. object type can hold any type of data. But you can't add value to it before you declare it. object a; a = "string"; You can also store any type of data in to dynamic variable dynamic a = "string"; The difference between object and dynamic is that the type checking on object happens on the compile time and on dynamic it happens on runtime.
26th Mar 2018, 2:41 PM
Toni Isotalo
Toni Isotalo - avatar