When I try to compile my class, I keep getting this error.
I am writing the code in notepad and compiling with the command line.error CS0246: The type or namespace name 'Dictionary' could not be found (are your missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'dict' could not be found (are you missing a using directive or an assembly reference?)
here's my code
and ideas on what's going on?????Code:using System; using System.Collections; class CH1_12 { public static void Main() { Dictionary dict = new Dictionary(); dict.Add(1, "C++"); dict.Add(2, "C"); dict.Add(3, "Ada"); dict.Add(4, "APL"); dict.Add(5, "VB"); dict.Add(6, "C#"); dict.Add(7, "Java"); dict.Add(8, "FORTRAN"); //Print out the list Console.WriteLine("Before Deleting Anything"); foreach(DictionaryEntry de in dict) { Console.WriteLine("Entry Key {0} Value {1}", de.Key, de.Value); } dict.Remove(4); dict.Remove(7); Console.WriteLine("After Deletions"); foreach(DictionaryEntry de in dict) { Console.WriteLine("Entry Key {0} Value {1}", de.Key, de.Value); } } }




Reply With Quote