Generating context code in Visual C # 2008?
I am typing
ArrayList memberNames = new ArrayList() { "Jim", "John", "George" };
and Visual Studio tells me that "ArrayList" cannot be found, so I have to manually go to the beginning of the file and type
using System.Collections;
Is there a way to get Visual Studio to do this automatically?
In FlashDevelop, for example, you press CTRL-SHIFT-1 and it automatically generates these missing links, a nice feature.
source to share
SHIFT-ALT-F10 will activate the Smart Tag in the class, which will give you the options "using System.Collections" and "System.Collections.ArrayList". Typically two keystrokes are used to add usage.
Edit: It seems I had a distorted keyboard profile. Updated default key combo. Thanks to Alan for that.
source to share
Alt+ Shift+ F10displays a popup menu using "System.Collections" and "System.Collections.ArrayList".
If you want to find a keyboard shortcut, select Tools: Options and go to Environment: Keyboard. However, it can be a challenge to figure out what they called what you are looking for. (The one you asked about is obviously View.ShowSmartTag, right?)
Update: From comments and other posts, I just found out that Ctrl+ .also displays the same menu. I think not all keyboard shortcuts appear in the Keyboard Options dialog box.
source to share