+ 1
The var keyword: what is a real world example where you would want to use this?
3 Respostas
+ 1
times when you are developing and are not sure up front which type you will use. you can change the value to change the type. then at the end, circle back anak explicitly type the declaration.
0
var keyword is variable type so you need to assign some value
mostly use in Linq query
- 1
It is usually used for complex expressions with complex result type like LINQ queries. And you have to use var keyword for anonymous types because the compiler generates them implicitly and you just can't use them as an explicit type for your variable.