public static void TestConstructorAndMethods() { int retInt; String retString; int conint; TestClassLearn tcl = new TestClassLearn("Start Test"); Console.WriteLine("Second object name is {0}", tcl.Name); retInt = tcl.GetMeNumber(20); retString = tcl.GetMeString("hello"); conint = int.Parse("100"); if (retInt > 100) { Console.WriteLine(retInt + "is greater than 100"); } else { Console.WriteLine(retInt + "is NOT greater than 100"); } Console.WriteLine(retString); Console.WriteLine("The string converted to int is " + conint); Console.WriteLine("\n nEW COURSE \n"); }
public static void TestParamsANDObj() { TestClassLearn newTCL = new TestClassLearn { Name = "Object Initializer" }; Console.WriteLine("Name is " + newTCL.GetMeName()); try { newTCL.UseParams(1, 5, 9, "test", "args"); } catch (Exception) { Console.WriteLine("Exception occured"); } }