+ 2
Using lists.
Hello, sololearners. I've been using lists a lot lately and normally declare a list like so: List <Employee> emp = new List <Employee> However, more and more (especially away from the tutorials), I see lists declared using 'var' instead, like so: var emp = new List <Employee> They both work, but I just wondered if there was a particular reason for using var instead? Cheers.
3 Respuestas
+ 4
It is like an all-encompasser of all datatypes, which is convenient than remembering multiple datatypes
+ 2
Nice one. Thanks for the replies.
+ 1
Thanks, I thought as much, but seeing as I know what types will populate the list, is the var still necessary?