Exemplo n.º 1
0
 public static void AddClearable(IClearable value)
 {
     if (clearableList.Contains(value) == false)
     {
         clearableList.Add(value);
     }
 }
Exemplo n.º 2
0
 public static void RemoveClearable(IClearable value)
 {
     if (clearableList.Contains(value))
     {
         clearableList.Remove(value);
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Lesson lesson1 = new Lesson(1, "math");
            Lesson lesson2 = new Lesson(2, "geography");
            Lesson lesson3 = new Lesson(3, "english");


            Person person1 = new Person(1, "moshe");
            Person person2 = new Person(2, "danny");
            Person person3 = new Person(3, "rueven");
            Person person4 = new Person(4, "dana");



            Student     student1    = new Student(5, "moshe student", 222, "ironi hey");
            StudentUniv studentUniv = new StudentUniv(6, "student ununv 1", 333, "Bar Ilan", "Bilding 1", "First");
            Person      person5     = new StudentUniv(7, "student ununv 2", 555, "Bar Ilan", "Bilding 1", "First");

            IPrintable printable1 = lesson1;
            IClearable clearable1 = lesson1;


            IPrintable printable2 = person2;
            IClearable clearable2 = lesson2;


            IPrintable printable3 = student1;
            IClearable clearable3 = student1;


            clearable1.Clear();


            List <IPrintable> allPrintables = new List <IPrintable>();

            allPrintables.Add(printable1);
            allPrintables.Add(printable2);
            allPrintables.Add(lesson2);
            allPrintables.Add(lesson2);
            allPrintables.Add(person2);
            allPrintables.Add(person3);
            allPrintables.Add(person4);
            allPrintables.Add(student1);


            MyPrinter myPrinter = new MyPrinter("http://ddd.com", 1, 1);

            PrinterWork.PrintAll(myPrinter, allPrintables);


            List <IMail> mailsList = new List <IMail>();

            mailsList.Add((IMail)studentUniv);
            mailsList.Add((IMail)person5);


            if (person1.CompareTo(person2) > 0)
            {
            }
        }
Exemplo n.º 4
0
 void IClearable.AddChild(IClearable child)
 {
     if (this.children == null)
     {
         this.children = new List <IClearable>();
     }
     this.children.Add(child);
 }
Exemplo n.º 5
0
 public CacheData(Func <T> dataFactory, IClearable parent = null)
 {
     this.dataFactory = dataFactory;
     if (parent != null)
     {
         parent.AddChild(this);
     }
 }
Exemplo n.º 6
0
 public void ClearEntity(IClearable clearable)
 {
     _entities.Remove(clearable as IEntity);
     _pregnantEntities.RemoveAll(e => e.Mother.Equals(clearable));
     clearable.Clear();
 }
Exemplo n.º 7
0
 public void AddClearable(IClearable clearable)
 {
     //viewModel.OnClearModelBinding += clearable.ClearModel;
     clearables.Add(clearable);
 }
Exemplo n.º 8
0
 public static void Clear(this IClearable c)
 {
     c.Clear(cmds: null);
 }