wingman007

2015_OOP_EnumNestedGeneric_Program

May 20th, 2015
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace World1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Days days = Days.Fr;
  14.             Console.WriteLine("My PI = {0}", Person.PI);
  15.             Console.WriteLine("Only for read = {0}", Person.onlyRead);
  16.  
  17.             // int counter = 0;
  18.             Person person1 = new Person("Stoyan", 51);
  19.             // person1.Name = "Stoyan";
  20.             // person1.Age = 51;
  21.             // counter++;
  22.  
  23.             Person person2 = new Person(20, "Mario", "Bobi", "Kristian", "Stoyan", "Anton");
  24.             // person2.Name = "Mario";
  25.             // person2.Age = 20;
  26.             // counter++;
  27.  
  28.             Person person3 = new Person();
  29.             // counter++;
  30.  
  31.             IncreasPopulation();
  32.  
  33.             person1.IntroduceYourSelf();
  34.             person2.IntroduceYourSelf();
  35.             person3.IntroduceYourSelf();
  36.  
  37.             Person.Nationality = "German";
  38.  
  39.             person1.IntroduceYourSelf();
  40.             person2.IntroduceYourSelf();
  41.             person3.IntroduceYourSelf();
  42.  
  43.             // Console.WriteLine("The population of my kingdom is {0}", counter);
  44.  
  45.             Console.WriteLine("The population of my kingdom is {0}", Person.Counter);
  46.  
  47.             Console.WriteLine("National Income = {0}", Person.GetNationalIncome());
  48.  
  49.             Person student1 = new Student("Kircho", 25, "4314324234");
  50.             student1.IntroduceYourSelf();
  51.  
  52.             Student student2 = new Student();
  53.  
  54.             Athlete athlete1 = new Athlete("Krisi", 25, "box");
  55.             athlete1.IntroduceYourSelf();
  56.  
  57.             Executor exec = new Executor(student1);
  58.             exec.MakeHimSpeak();
  59.  
  60.             Console.WriteLine(student1); // .ToString()
  61.  
  62.  
  63.             /*
  64.             Console.WriteLine("My name is {0}! I am {1} years old! My balance is {2}",
  65.                 person1.Name, person1.Age, person1.Balance);
  66.  
  67.             Console.WriteLine("My name is {0}! I am {1} years old!",
  68.                 person2.Name, person2.Age);
  69.  
  70.             Console.WriteLine("My name is {0}! I am {1} years old!",
  71.                 person3.Name, person3.Age);
  72.             */
  73.             // We can declare a variable of type Days which is enum
  74.             Days day = Days.Fr;
  75.            
  76.             Console.WriteLine(Days.Fr);
  77.             Console.WriteLine((int)Days.Fr);
  78.             Console.WriteLine(Days.Fr is Days);
  79.  
  80.             Manager<Student> man1 = new Manager<Student>();
  81.             man1.AddEntity(student2);
  82.             man1.AddEntity(student2);
  83.             man1.AddEntity(student2);
  84.             man1.RemoveEntity();
  85.             man1.RemoveEntity();
  86.             Console.WriteLine(man1.GetNumberOfEntities());
  87.  
  88.         }
  89.  
  90.         private static void IncreasPopulation()
  91.         {
  92.             Person person1 = new Person("Petko", 15);
  93.         }
  94.         public enum Days
  95.         {
  96.             Mo, Tu, We, Th, Fr = 1400, Sa, Su // Mo = 0 ... Fr = 1400 then Sa = 1401 Su = 1402
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment