Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Delete.B obj = new Delete.B();
            obj.test();
            Delete.B objdelA = new Delete.B();
            objdelA.test1();
            Delete.B B = new Delete.B();
            //B.X=10;//error


            Delegates.Base bggt = new Delegates.Deri();

            Delegates.PrivateProperty exm = new Delegates.PrivateProperty();

            Debug.WriteLine(exm.IsFound);
            Tester Olli = new Tester("Olli", 4, TesterFavoriteTasks.SystemTesting);


            Developer Tom = new Developer("Tom", 3, DeveloperFavoriteTasks.UnitTesting, false);

            Developer Sam = ChangeYearsOfExperience(Tom);

            Debug.WriteLine(Tom == Sam);
            Sam.DoWork();
            //test

            List <State> statesList = new List <State>();

            statesList.Add(new State {
                Name = "A"
            });
            statesList.Add(new State {
                Name = "B"
            });
            statesList.Add(new State {
                Name = "C"
            });
            statesList.Add(new State {
                Name = "D"
            });
            statesList.Add(new State {
                Name = "E"
            });
            statesList.Add(new State {
                Name = "F"
            });
            var t   = statesList.Where(s => s.Name == "A" || s.Name == "D").Take(1).ToList();
            var t1  = statesList.Where(s => s.Name == "A" || s.Name == "D");
            var car = new Practices1.Car {
                MaxSpeed = 20
            };

            car.Drive();
            Practices1.Vehicle vh = new Practices1.Car {
                MaxSpeed = 29
            };
            vh.Drive();

            for (int i = 0; i < statesList.Count; i++)
            {
                Console.WriteLine(statesList[i] + " ");
                statesList.RemoveAt(i);
            }

            var list = new[] { "A", "B", "C", "D", "E" };
            var half = list.Where((x, i) => i < 3).ToList();
            var lst  = Enumerable.Range(1, 10).ToList();

            lst.ForEach(Dosomething);

            var car2 = new Practices2.Car(200, "Manual");

            Debug.WriteLine(string.Format("max speed is {0} , country is {1}", car2.MaxSpeed, Practices2.Vehicle.Country));
            //IQueryable<State> staes = from p in obj.Where(ChekName()) select p; //dont work
            var staes1 = from p in statesList.Where(ChekName()) select p;

            Practices2.Shape circle = new Practices2.Circle
            {
                Radius = 10, Color = "Red"
            };
            circle.Draw();
            int number = 50;

            ChangeNumber(ref number);
            Debug.WriteLine(number);
            //dynamic objdyn = new dynamic();
            //objdyn.City = "Test";
            //dynamic objdyn1 = new { City = "Manish" }; // this statement alone won't give error but with below statement would
            //objdyn1.City = "NewYork";

            dynamic obj1 = new System.Dynamic.ExpandoObject();

            obj1.City = 1;
            obj1.City = "NY";

            //Console.WriteLine(obj.City);
            var tttt = new  { City = "New York" };

            Console.WriteLine(tttt.City);
            Console.WriteLine(obj1.City);

            string weather = "rainy";

            Practices2.Forecast.ChangetheString(weather);
            Debug.WriteLine("The weather is " + weather);
            string[] RainyDys = new [] { "monday", "friday" };
            Practices2.Forecast.ChangeArray(RainyDys);
            Debug.WriteLine("The rainy days are " + RainyDys[0] + " and " + RainyDys[1]);
            Practices2.SForecast fore = new Practices2.SForecast {
                Pressue = 700, Temprature = 20
            };
            Practices2.Forecast.ChangetheStructure(fore);
            Debug.WriteLine("The temprature is " + fore.Temprature);



            var S = new List <int>();

            for (int i = 0; i < 10; i++)
            {
                S.Add(i);
            }
            for (int i = 0; i < S.Count; i++)
            {
                Debug.WriteLine(S[i] + " ");
                S.RemoveAt(i);
            }

            Delegates.Utility.Do(1);
            //test



            DateTime dat = Convert.ToDateTime("13-Mar-2014 12:49");

            List <CustomTime> objLocal;

            objLocal = (TimeZoneConverter.TimeZones.FindAll(x => (x.Id.Equals("Eastern Standard Time") || x.Id.Equals("Central Standard Time") || x.Id.Equals("US Mountain Standard Time") ||
                                                                  x.Id.Equals("Mountain Standard Time") || x.Id.Equals("Pacific Standard Time") || x.Id.Equals("Alaskan Standard Time") || x.Id.Equals("UTC-11"))));

            TimeZoneConverter.ConvertTime(dat, objLocal[1].Id);
            //TimeZoneInfo.ConvertTimeFromUtc(dat.ToUniversalTime(), TimeZoneInfo.FindSystemTimeZoneById(""));

            ///big daddt
            ///

            TimeZoneConverter.TimeZones.ForEach((time) => { Console.WriteLine(time.DisplayName + "  " + time.UTC); });

            ExcelWriter.ExcelWriter.CreateExcelTemplate("testmanish.xls");
            for (int j = 0; j < 7000; j++)
            {
                for (int col = 0; col < 63; col++)
                {
                    ExcelWriter.ExcelWriter.WriteContent(j + 4, col, "Manish");// remember the starting row is 4
                }
            }
            ExcelWriter.ExcelWriter.WriteToFile(@"D:\testmanish.xls");
        }