public Object Clone() //@20180108-vincent: ICloneable interface { PClass newPc = new PClass(); newPc.Name = this.Name; newPc.Color = this.Color; return(newPc); }
internal int GetInt(int x) => x + 100; //@20180108-vincent: element body static void Main(string[] args) { System.Diagnostics.Debug.WriteLine("Hello"); Program p = new Program(); Console.WriteLine("Element body:" + p.GetInt(7)); PClass pc = new PClass(100, 200); PClass shallowCopyPc = pc; PClass deepCopyPc = new PClass(); deepCopyPc.Name = pc.Name; deepCopyPc.Color = pc.Color; //@20180108-vincent: deep copy PPClass pp = new PPClass(); pp.Test(); Ironman tony = new Ironman(); tony.Initialize(); ArmorSuite amSuite = tony; amSuite.Initialize(); Collections cl = new Collections(); EnumerableTest <string> et = new EnumerableTest <string>(); for (int i = 0; i < 5; i++) { et[i] = i.ToString(); } foreach (var e in et) { Console.WriteLine("EnumerationTest: " + e); } Generic <int> gInt = new Generic <int>(); gInt.AddElement(5, 0); gInt.AddElement(6, 1); gInt.AddElement(7, 2); Console.WriteLine("Generic: " + gInt.GetElement(0)); Console.WriteLine("Generic: " + gInt.GetElement(1)); try { Exceptions.TestException(); } finally { Console.WriteLine("Calling finally"); } EventDelegateAction del = new EventDelegateAction(); del.TestDelegate(); del.TestEvent(); NETConsoleApp.Lambda l = new NETConsoleApp.Lambda(); l.TestLambda(); FunctionAction fa = new FunctionAction(); fa.TestFunction(); fa.TestAction(); fa.TestExpression(); ReflectionAttribute ra = new ReflectionAttribute(); ra.TestReflection(); ra.TestAttribute(); Dynamic dm = new Dynamic(); dm.TestDynamic(); ThreadAndTask tt = new ThreadAndTask(); tt.TestThread(); tt.TestMonitor(); tt.TestTask(); //tt.TestTaskComplex(); tt.TestParallel(); tt.TestAsync(); Console.ReadLine(); SpecialOperators.TestSpecials(); LINQ tl = new LINQ(); tl.TestLINQ(); Files f = new Files(); f.TestFile(); del.TestRealEvent(); }