public static void Overload4(this OversSup o, string p, params string[] a) { Console.WriteLine("long method"); IControl i = new MyControl(); i.Paint(); }
public static void Overload5(this OversSup o, byte s) { }
public static void Overload4(this OversSup o, params string[] a) { Console.WriteLine("short method"); Overload5(o, 1); }
public static void Overload3(this OversSup o, object t) { Console.WriteLine("super method"); }
public static void Overload2(this OversSup o, string t) { }
static void Main() { Opt(0); //ref int i = ref myTotalCount.Value; //int t = CurVal(); /* List<string> list = new List<string>(); * list.Add("b"); * list.Add("a"); * list.Add("bb"); * list.Add("aa"); * list.Sort(); * foreach (string s in list) { * Console.WriteLine(s); * } * Console.WriteLine(list.Max(s => { return s.Length; })); * Console.WriteLine(list.Min(s => { return s.Length; })); * Predicate<string> predic = s => s.StartsWith("a"); * //Func<string, bool> fct = predic; * //list.Select<string,bool>(predic); * foreach ( int l in list.Select(s => s.Length)) { * Console.WriteLine("len:" + l); * } * foreach (string s in list.FindAll(s => s.StartsWith("a"))) * { * Console.WriteLine("found:"+s); * } * CustList<Pref> pr = new CustList<Pref>(); * Pref e = new Pref(); * pr.Add(e); * Console.WriteLine(pr.IndexOf(e)); * NbCustList prNb = new NbCustList(); * int eNb = 2; * prNb.Add(eNb); * Console.WriteLine(prNb.IndexOf(eNb)); * Console.WriteLine(prNb.IndexOfNb(eNb)); * Console.WriteLine("def str:" + (default(string) == null)); * Console.WriteLine("def int:" + (default(int) == 0));*/ //; //List.Sort() /*List<Pref> Prefs = new List<Pref>(); * Prefs.Add(new Pref()); * Prefs.Add(new Pref()); * Prefs.Sort(); * //List.Max(string::Length); * cte = new CountdownEvent(1); * // Start three threads. * for (int ctr = 0; ctr <= 2; ctr++) * { * cte.AddCount(); * Thread th = new Thread(GenerateNumbers); * th.Name = "Thread" + ctr.ToString(); * th.Start(); * } * cte.Signal(); * cte.Wait(); * Console.WriteLine(); * Console.WriteLine("Total midpoint values: {0,10:N0} ({1:P3})", * myTotalAtMidPt.Value, myTotalAtMidPt.Value / ((double)myTotalCount.Value)); * Console.WriteLine("Total number of values: {0,10:N0}", * myTotalCount.Value);*/ /*Application.EnableVisualStyles(); * Application.SetCompatibleTextRenderingDefault(false); * Application.Run(new Form1());*/ //sstring c = (string)b; /*flag.Set(true); * Thread thFl = new Thread(Display); * Thread thLo = new Thread(Load); * thFl.Start(); * thLo.Start(); * thFl.Join(); * thLo.Join();*/ Overs o = new Overs(); o.Overload(""); OversSup o2 = new OversSup(); o2.Overload2(""); Overload2(o2, ""); o2.Overload3(""); o2.Overload3(1); Overload3(o2, ""); o2 = new Overs(); Overload3(o2, ""); Overload4(o2, "", ""); }