I wish to know whether there is any way to find out which using directive needs to a particular code.
For example following program is needed using System; and using System.Collections; using directives because it uses Hashtable and DictionaryEntry in the code.
using System;
using System.Collections;
class Program
{
static void Main()
{
// Create hashtable with some keys and values.
Hashtable hashtable = new Hashtable();
hashtable.Add(1, "one");
hashtable.Add(2, "two");
hashtable.Add(3, "three");
// Enumerate the hashtable.
foreach (DictionaryEntry entry in hashtable)
{
Console.WriteLine("{0} = {1}", entry.Key, entry.Value);
}
Console.ReadKey();
}
}
/*
3 = three
2 = two
1 = one
*/
Loading
Posted Aug 9, 2013, 5:13 PM
Hemant SrivastavaPosted Aug 9, 2013, 3:09 PM
If you have not added required directive and you want to add its ;using directive', right click that code, then go to Resolve' option and choose the required directive. Visual studio will automatically add the required 'using directive' for you.
VulpesPosted Aug 9, 2013, 1:03 PM
http://weblogs.asp.net/jeffwids/archive/2009/10/20/use-ctrl-period-to-trigger-visual-studio-s-automatic-add-using-statement-context-menu.aspx
Posted Aug 9, 2013, 12:10 PM
Anurag SarkarPosted Aug 9, 2013, 11:39 AM