Usage of the C# var keyword -


this question has answer here:

i confused usage var keyword in c#.
know, var make code more easier read, speed , memory?

a.

  1. var = 100;
  2. int b = 100;
  3. int c; c = 100;

b.

  1. var lista = new list<obj>();
  2. list<obj>listb = new list<obj>();
  3. 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.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -