TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Olivier Muhring
NA
150
10.1k
To var or not to var
Jun 15 2012 10:52 AM
Since .NET 3.5 the keyword "var" was introduced into the C# language. I used to think it was an oddity, mostly used by programmers who don't feel like declaring all their variables at the beginning of a methods, or simply liked to use it as a "shortcut" in some situations. Most of the examples I saw over the years where just that.
Recently, however, I've started to use Resharper, to assist me in my development projects. And Resharper continuously suggests to replace my declared variables with var constructs.
Hence my question: to var, or not to var? When do I use var, and when do I not. Is there a rule of thumb, or just a simple personal preference?
Reply
Answers (
2
)
Context menu stuck while selecting Files.
I'm currently working on a small mvc project. On itself nothing special, I'm a big supporter of the ...