示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static ComplexDummyClass CreateComplexDummy()
        {
            ComplexDummyClass dummy = new ComplexDummyClass();
              SetComplexDummyValues(dummy);

              return dummy;
        }
示例#2
0
        /// <summary>
        /// Sets the properties and values of an ComplexDummyClass.
        /// </summary>
        /// <returns></returns>
        public static void SetComplexDummyValues(ComplexDummyClass dummy)
        {
            dummy.Name = "Marcus";
              dummy.DecimalNumber = (Decimal)12345.7894;
              dummy.Number = 123;
              dummy.ExampleColor = Color.FromArgb(255, 192, 128);
              dummy.ArrowDirection = System.Windows.Forms.ArrowDirection.Right;

              // SimpleDummy
              dummy.SimpleDummy = new SimpleDummyClass("Diggn", 41);
              dummy.SimpleDummy.ExampleColor = Color.Teal;

              SimpleDummyClass sd = new SimpleDummyClass("Yaowi", 36);
              sd.Dummy = new SimpleDummyClass("Dedl", 71);
              sd.Dummy.ExampleColor = Color.Red;
              sd.ExampleColor = Color.Turquoise;

              dummy.SimpleDummy.Dummy = sd;

              // Array
              SimpleDummyClass sd1 = new SimpleDummyClass();
              sd1.Name = "Dieter";
              sd1.Age = 42;
              string[] sarr = new string[] { "er", "sie", "es" };

              dummy.ObjectArray[0] = 125.45;
              dummy.ObjectArray[1] = "Yaowalak";
              dummy.ObjectArray[2] = sarr;
              dummy.ObjectArray[3] = sd1;

              // Hashtable
              SimpleDummyClass sd2 = new SimpleDummyClass();
              sd2.Name = "Hans";
              sd2.Age = 25;

              Hashtable ht = new Hashtable();
              ht.Add("ich", null);
              ht.Add(50, "Margot");
              ht.Add(125.45, 100);
              ht.Add("Peter", 128759364.45);
              ht.Add("Klaus", "Dieter");

              dummy.Hashtable.Add(50, "Marcus");
              dummy.Hashtable.Add("B", Color.AntiqueWhite);
              dummy.Hashtable.Add(12.45, sd2);
              dummy.Hashtable.Add("mytable", ht);

              // ArrayList
              ArrayList al = new ArrayList();
              al.Add("JUMBO");
              al.Add(17);
              al.Add(DateTime.Now);

              dummy.Arraylist.Add("Moin");
              dummy.Arraylist.Add(sd2);
              dummy.Arraylist.Add(1254);
              dummy.Arraylist.Add(al);
        }