0
what is dynamic and var ?
2 Respostas
+ 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.
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