Usage of the C# var keyword -
this question has answer here:
- will using 'var' affect performance? 11 answers
i confused usage var
keyword in c#
.
know, var
make code more easier read, speed , memory?
a.
var = 100;
int b = 100;
int c; c = 100;
b.
var lista = new list<obj>();
list<obj>listb = new list<obj>();
list<obj>listc; listc = new list<obj>();
which faster?
there dependence on type?
how memory allocated in both situation , when memory allocated?
which faster?
neither, they're same.
there dependence on type?
i'm not sure you're asking here, there's no difference between of code snippets once compiled, i'll go no.
how memory allocated in both situation , when memory allocated?
it's same of them. int
example it's 32 bits cases. list
example 3 allocate 1 word reference, plus memory actual list instance.