foreach uses var

Mon, August 6, 2007, 04:32 AM under Orcas | VisualStudio
Whenever I want to loop through a collection of some sort, in C# I type foreach and hit the TAB key twice (to invoke the code snippet). This gives me the following code template:
    foreach (object var in collection_to_loop)

...where object is highlighted so you can change it to the real type of your collection, var is highlighted so you can change it if you wish to have your own variable name and collection_to_loop is highlighted so you can change it to your actual collection variable name.

This always looked awkward to me when playing with LINQ since I typically use the keyword var to replace the object and then immediately I am confronted with var as the variable name that I change only so the awkwardness can go away.

In Visual Studio 2008 Beta 2 you get the following with the foreach code snippet:

No awkwardness, automatic use of local variable inference and, generally speaking, only one item to replace: collection.

Are you revisiting your own code snippets making them more user friendly?