0

what is dynamic and var ?

22nd Jun 2016, 11:45 AM
MaxDesuza...
MaxDesuza... - avatar
2 ответов
+ 1
Dynamic:dynamic is allocating size at run time.That is it is not static you can increase or decrease the size of the array. var:var is used when you don't know the data type of the input.var will type cast itself into data type if given input.
23rd Jun 2016, 6:52 PM
rohith chittamuru
rohith chittamuru - avatar
0
dynamic allows you to bypass compile time type checking. Its use gets a little complicated but essentially the compiler will ignore any members/properties you call on the object and just compile the code. "dynamic (C# Reference)" - https://msdn.microsoft.com/en-us/library/dd264741.aspx var allows the compiler to infer the data type at compile time. These two statements are the same: int a = 12; // declared to be an int var a = 12; // inferred to be an int by the compiler "var (C# Reference)" - https://msdn.microsoft.com/en-us/library/bb383973.aspx
4th Nov 2016, 3:53 PM
Michael Dolence