KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The var keyword does away with the need for an explicit type declaration and I have read with interest the SO discussion of when it might be appropriate. I have also read about (but not used) Boo which seems to take things a step further by making it optional to declare a local variable . With Boo, both the type and the declaration can be implied. Which leads me to wonder, why did the C# language designers bother to include a var keyword at all? Update : Yes, var supports Anonymous types, but anonymous types by themselves do not necessitate the var keyword... var anon = new { Name = "Terry", Age = 34 }; versus anon = new { Name = "Terry", Age = 34 };
Tags (comma-separated)
Save Edits
Cancel