Click here to Skip to main content
16,015,658 members

Comments by chrisbray (Top 1 by date)

chrisbray 18-Jul-11 17:51pm View    
Deleted
We have a simple rule for the use of var: it may ONLY be used if the data type is apparent from the code. Therefore this is permitted:

var user = new User();

This is not:

var user = GetUser();

Although you would think that both would have the same result, there is no guarantee with the second option as it could return anything. Relying on Intellisense is not permitted, because the code may not be read in something that supports it (e.g. browsers as mentioned before).