Exemple #1
0
        private void InitializeBasicClass(int id, ref BasicClass basicClass)
        {
            basicClass.Id = id;

            basicClass.CharacterProperty   = 'a';
            basicClass.ClassProperty       = typeof(object);
            basicClass.CultureInfoProperty = CultureInfo.CurrentCulture;
            basicClass.DateTimeProperty    = DateTime.Parse("2003-12-01 10:45:21 AM");
            basicClass.Int16Property       = Int16.MaxValue;
            basicClass.Int32Property       = Int32.MaxValue;
            basicClass.Int64Property       = Int64.MaxValue;

            // more MySql problems - it returns 3.40282E38
            // instead of 3.402823E+38 which is Single.MaxValue
            basicClass.SingleProperty    = 3.5F;          //Single.MaxValue;
            basicClass.StringProperty    = "string property";
            basicClass.TicksProperty     = DateTime.Now;
            basicClass.TrueFalseProperty = true;
            basicClass.YesNoProperty     = true;

            basicClass.StringArray = new string[] { "3 string", "2 string", "1 string" };
            basicClass.Int32Array  = new int[] { 5, 4, 3, 2, 1 };

            IList stringBag = new ArrayList(3);

            stringBag.Add("string 0");
            stringBag.Add("string 1");
            stringBag.Add("string 2");

            basicClass.StringBag = stringBag;

            IList stringList = new ArrayList(5);

            stringList.Add("new string zero");
            stringList.Add("new string one");
            stringList.Add("new string two");
            stringList.Add("new string three");
            stringList.Add("new string four");

            basicClass.StringList = stringList;

            IDictionary stringMap = new Hashtable();

            stringMap.Add("keyOne", "string one");
            stringMap.Add("keyZero", "string zero");
            stringMap.Add("keyTwo", "string two");

            basicClass.StringMap = stringMap;

            basicClass.AddToStringSet("zero");
            basicClass.AddToStringSet("one");
            basicClass.AddToStringSet("zero");
        }