示例#1
0
        public static void main()
        {
            int    res;
            Class4 ob = new Class4();

            res = ob.method();
            Console.WriteLine("res=" + res);
        }
示例#2
0
        static void Main(string[] args)
        {
            Class3 hola = new Class3();
            Class4 chau = new Class4();

            hola.Algo();
            hola.algo();

            chau.algoC();
            chau.Algo();
        }
        static void Main(string[] args)
        {
            string encrypted = Encryption.Encrypt("Hitendra", true);

            Console.WriteLine(encrypted);
            string decrypted = Encryption.Decrypt(encrypted, true);

            Console.WriteLine(decrypted);

            Func <int, string, bool> ob = (int x1, string s) => s.Length > x1;

            ob(5, "Hello");
            Action <string, int> ob1 = (string x2, int s2) => Console.WriteLine($"{x2} and {s2.ToString()}");

            ob1("Test", 5);
            Test <int>(1); // this will work
            //Test<string>(""); Will not permitted since the T is struct
            Class1 c11 = new Class1();

            Console.WriteLine(c11.Test <float>(5.2f, 1.6f));
            Console.WriteLine(GeneratePassword(4, 2, 1, 1));
            int[] q   = { 0, 1, 2, 3, 4 };
            int[] r   = { 5, 6, 7, 8, 9 };
            int[] res = MergedArray(q, r);
            foreach (int item in res)
            {
                Console.WriteLine(item.ToString());
            }
            Class3 three = new Class4();

            three.Do();
            three.DoIt();
            int[] a      = { 1, 2, 3, 4, 5 };
            int[] p      = { 3, 4, 1, 8, 9 };
            int[] result = DoIntersection(a, p);
            Test  test   = new Test();//new Test("Hitendra Kumar", 35);

            test.DisplayName();
            PrintPiramid(7);
            int factorial = Factorial(6, 1);

            WriteLine($"Factorial value of given number is :{factorial}");
            WriteLine($"Calling Expression Bodied Method: {Test(5)} ");
            int[] arr   = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            int   total = 0;

            total = RecursiveMethod(0, arr, 0);
            Console.WriteLine(total);

            Console.WriteLine(CheckSquareRoot <Boolean>(25));
            int[] array = { 1, 2, 3, 4, 5 };
            Array.ForEach(array, i => Console.WriteLine(i));
            Class1 c = new Class1();

            c.Add(3f, 3);
            c.Add(8, 7f);
            string x  = "kkk";
            Class1 c1 = new Class2();

            c1.Calculate();
            ((Class2)c1).Calculate();
            c1.Add(8, 9);
            c1.Test <int>(null, 5);
            using (BaseDisposable b = new ChildClassA())
            {
            }

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn {
                ColumnName = "Name", DataType = typeof(string)
            });
            dt.Columns.Add(new DataColumn {
                ColumnName = "Age", DataType = typeof(int)
            });
            DataRow dr = dt.NewRow();

            dr["Name"] = "Hitendra";
            dr["Age"]  = 35;
            dt.Rows.Add(dr);
            //DataRow dr = new DataRow(new DataColumn { ColumnName="Name", DataType=typeof(string)}));

            var row = dt.AsEnumerable().ToList();

            SomeMethod(dt);
            row.ForEach(d => Console.WriteLine(d["Name"] + "" + d["Age"]));
        }