I am confused about this problem. The code is syntactically correct however when placing the code into a new class it refuses to compile and brings up errors of token problems.
Any ideas why this occurs?
Code:using System; namespace MCTSExample2 { class foo1 { static void Main(string[] args) { SByte a=0; Byte b=0; Int16 c=0; Int32 d=0; Int64 e=0; String f = "t"; Exception g = new Exception(); object[] types ={a,b,c,d,e,f,g}; foreach (object obj in types) { string type; if (obj.GetType().IsValueType) type = "Value Type"; else type = "Reference type"; Console.WriteLine("{0}: {1}", obj.GetType(), type); } ; Console.ReadLine(); } } class lala { string ui = "Microsoft .NET Framework Application Development Foundation"; string[] ui2 = ui.Split(' '); Array.Sort(ui2) //when all the code in this class is put into the main method compiles correctly } }




Reply With Quote