Click here to Skip to main content
15,902,114 members

Survey Results

How often do you use the var type in C#? (1= never, 5=always)   [Edit]

Survey period: 17 Aug 2009 to 24 Aug 2009

The var keyword can be a saint or a sinner. Choose "1" if you never use var in this scenario (or never use that scenario), up to "5" for always, whenever possible. (Suggested by Asher)

OptionVotes12345 
In normal C# coding (1 = you don"t code in C#, 5=for all C# variables possible)9370%0%0%0%0%
With LINQ9370%0%0%0%0%
For declaring complex types9370%0%0%0%0%
For using complex types (eg in foreach loops)9370%0%0%0%0%
With anonymous types9370%0%0%0%0%
When it saves typing9370%0%0%0%0%
When it makes the code look better (to you)9370%0%0%0%0%

View optional text answers (46 answers)


 
Generalvar is ugly PinPopular
Huisheng Chen17-Aug-09 3:08
Huisheng Chen17-Aug-09 3:08 
GeneralRe: var is ugly Pin
Xmen Real 17-Aug-09 3:35
professional Xmen Real 17-Aug-09 3:35 
GeneralRe: var is ugly Pin
Todd Smith17-Aug-09 13:04
Todd Smith17-Aug-09 13:04 
GeneralRe: var is ugly Pin
PIEBALDconsult17-Aug-09 13:07
mvePIEBALDconsult17-Aug-09 13:07 
GeneralRe: var is ugly Pin
Todd Smith17-Aug-09 13:15
Todd Smith17-Aug-09 13:15 
GeneralRe: var is ugly PinPopular
PIEBALDconsult17-Aug-09 18:03
mvePIEBALDconsult17-Aug-09 18:03 
AnswerRe: var is ugly Pin
Gtrwld18-Aug-09 0:07
Gtrwld18-Aug-09 0:07 
GeneralRe: var is ugly Pin
Todd Smith19-Aug-09 17:56
Todd Smith19-Aug-09 17:56 
Gtrwld wrote:
This is typically the case when you won't use var because you want to use your AwesomeJunk as an IJunk but var will make it an AwesomeJunk.


So you just cast it if you need an IJunk.

The assumption here is public class AwesomeJunk : IJunk

It's very handy when writing things like linq extension methods.

Todd Smith

GeneralRe: var is ugly Pin
JP van Mackelenbergh18-Aug-09 20:24
JP van Mackelenbergh18-Aug-09 20:24 
GeneralRe: var is ugly Pin
Daniel Vaughan18-Aug-09 23:17
Daniel Vaughan18-Aug-09 23:17 
GeneralRe: var is ugly Pin
Kamarey22-Aug-09 3:14
Kamarey22-Aug-09 3:14 
General[Message Deleted] Pin
Alexandre GRANVAUD16-Aug-09 21:24
Alexandre GRANVAUD16-Aug-09 21:24 
GeneralRe: Thanks for this C# only survey Pin
Derek Bartram16-Aug-09 23:34
Derek Bartram16-Aug-09 23:34 
JokeRe: Thanks for this C# only survey Pin
Keith Barrow17-Aug-09 5:26
professionalKeith Barrow17-Aug-09 5:26 
GeneralRe: Thanks for this C# only survey Pin
Derek Bartram17-Aug-09 6:17
Derek Bartram17-Aug-09 6:17 
GeneralRe: Thanks for this C# only survey Pin
Netblue17-Aug-09 7:36
Netblue17-Aug-09 7:36 
GeneralNever!!! PinPopular
Great Crested Dave16-Aug-09 20:43
Great Crested Dave16-Aug-09 20:43 
GeneralRe: Never!!! Pin
Member 448708317-Aug-09 1:01
Member 448708317-Aug-09 1:01 
GeneralRe: Never!!! Pin
louthy17-Aug-09 4:33
louthy17-Aug-09 4:33 
GeneralRe: Never!!! Pin
PIEBALDconsult17-Aug-09 5:48
mvePIEBALDconsult17-Aug-09 5:48 
GeneralRe: Never!!! Pin
louthy17-Aug-09 6:30
louthy17-Aug-09 6:30 
GeneralRe: Never!!! Pin
keozcigisoft17-Aug-09 6:58
keozcigisoft17-Aug-09 6:58 
GeneralRe: Never!!! Pin
Netblue17-Aug-09 7:42
Netblue17-Aug-09 7:42 
GeneralRe: Never!!! Pin
PIEBALDconsult17-Aug-09 13:11
mvePIEBALDconsult17-Aug-09 13:11 
GeneralRe: Never!!! Pin
keozcigisoft17-Aug-09 17:36
keozcigisoft17-Aug-09 17:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.