Пример #1
0
        static void Main(string[] args)
        {
            // Var vs Dynamics

            //var x = "sting1";
            //Console.WriteLine(x.GetType().ToString());
            //Console.WriteLine(x.Length.ToString());

            //dynamic y = 1;
            //Console.WriteLine(y.GetType().ToString());
            //Console.WriteLine(y.Length.ToString());

            // CONST VS READONLY

            //  psrInt = 3;
            Object  o          = 1;
            TestRef objTestRef = new TestRef();

            objTestRef.TestRefMethod(ref o);

            //Console.WriteLine(((Int32)o).ToString());

            string s = "main method";

            objTestRef.TestRefMethod(s);
            //Console.WriteLine(s);

            string r = "main method";

            objTestRef.TestRefMethod(out r);
            //Console.WriteLine(r);

            SomeMeths sMaths = new SomeMeths();
            //Console.WriteLine(sMaths.Add(1,2).ToString());
            //Console.WriteLine(sMaths.Substract(1,2).ToString());

            int     i = 1;
            dynamic d = i;

            Console.WriteLine(d.GetType().ToString());

            Console.Read();
        }
Пример #2
0
 // extendion method which extends SomeMeths class
 public static int Substract(this SomeMeths obj, int x, int y)
 {
     return(x - y);
 }