Example #1
0
        public static void ListOfList()
        {
            var o = new List <List <object> > {
                new List <object> {
                    1, 2, 3
                }, new List <object> {
                    "aa", 3, "bb"
                }
            };
            var s = fastBinaryJSON.BJSON.ToBJSON(o);
            //Console.WriteLine(s);
            var i = fastBinaryJSON.BJSON.ToObject(s);
            var p = new lol {
                r = o
            };

            s = fastBinaryJSON.BJSON.ToBJSON(p);
            //Console.WriteLine(s);
            i = fastBinaryJSON.BJSON.ToObject(s);
            Assert.AreEqual(3, (i as lol).r[0].Count);

            var oo = new List <object[]> {
                new object[] { 1, 2, 3 }, new object[] { "a", 4, "b" }
            };

            s = fastBinaryJSON.BJSON.ToBJSON(oo);
            //Console.WriteLine(s);
            var  ii = fastBinaryJSON.BJSON.ToObject(s);
            lol2 l  = new lol2()
            {
                r = oo
            };

            s = fastBinaryJSON.BJSON.ToBJSON(l);
            //Console.WriteLine(s);
            var iii = fastBinaryJSON.BJSON.ToObject(s);

            Assert.AreEqual(3, (iii as lol2).r[0].Length);
        }
Example #2
0
        public void ListOfList()
        {
            var o = new List <List <object> > {
                new List <object> {
                    1, 2, 3
                }, new List <object> {
                    "aa", 3, "bb"
                }
            };
            var s = JSON.ToJSON(o);

            Console.WriteLine(s);
            var i = JSON.ToObject(s);
            var p = new lol {
                r = o
            };

            s = JSON.ToJSON(p);
            Console.WriteLine(s);
            i = JSON.ToObject(s);
            Assert.AreEqual(3, (i as lol).r[0].Count);

            var oo = new List <object[]> {
                new object[] { 1, 2, 3 }, new object[] { "a", 4, "b" }
            };

            s = JSON.ToJSON(oo);
            Console.WriteLine(s);
            var  ii = JSON.ToObject(s);
            lol2 l  = new lol2()
            {
                r = oo
            };

            s = JSON.ToJSON(l);
            Console.WriteLine(s);
            var iii = JSON.ToObject(s);

            Assert.AreEqual(3, (iii as lol2).r[0].Length);

            var o3 = new List <baseclass[]> {
                new baseclass[] {
                    new baseclass()
                    {
                        Name = "a"
                    },
                    new baseclass()
                    {
                        Name = "b", Code = "c"
                    }
                }, new baseclass[] {
                    new baseclass {
                        Name = "d"
                    },
                    null,
                }, null
            };

            s = JSON.ToJSON(o3, new JSONParameters()
            {
                UseExtensions = false
            });
            var iv = JSON.ToObject <List <baseclass[]> > (s);

            Console.WriteLine(JSON.ToJSON(iv));
        }
Example #3
0
            static void Main(string[] args)
            {
                WriteLine("Vvod Data: ");
                WriteLine("Day: ");
                int day = ToInt32(ReadLine());

                WriteLine("Month: ");
                int month = ToInt32(ReadLine());

                WriteLine("Year: ");
                int year = ToInt32(ReadLine());


                lol a = new lol();

                WriteLine("1 - Dobavit studenta.\n2 - Izmenit dannye studenta.\n3 - Udalit studenta.\n4 - Vse studenty.");

                int n = ToInt32(ReadLine());

                while (n > 0)

                {
                    if (n == 1)

                    {
                        WriteLine("ID: "); string ID = ReadLine();

                        WriteLine("FIO: "); string FIO = ReadLine();

                        WriteLine("Group: "); string GROUP = ReadLine();

                        WriteLine("Data: "); string DATA = ReadLine();

                        a.add(ID, FIO, GROUP, DATA);

                        WriteLine("Vvod deist: ");

                        n = ToInt32(ReadLine());
                    }

                    else if (n == 2)

                    {
                        WriteLine("Vvod ID i izmen. dannye: ");

                        WriteLine("ID: "); string ID = ReadLine();

                        WriteLine("FIO: "); string FIO = ReadLine();

                        WriteLine("Group: "); string GROUP = ReadLine();

                        WriteLine("Data: "); string DATA = ReadLine();

                        a.change(ID, FIO, GROUP, DATA);

                        WriteLine("Vvod deist: ");

                        n = ToInt32(ReadLine());
                    }

                    else if (n == 3)

                    {
                        WriteLine("Vvod ID: ");

                        string ID = ReadLine();

                        a.remov(ID);

                        WriteLine("Vvod deist: ");

                        n = ToInt32(ReadLine());
                    }

                    else if (n == 4)

                    {
                        a.show();

                        WriteLine("Vvod deist: ");

                        n = ToInt32(ReadLine());
                    }
                    else if (n == 5)

                    {
                        WriteLine("Vvod ID: ");
                        string ID = ReadLine();
                        a.viv(ID);
                        WriteLine("Vvod deist: ");
                        n = ToInt32(ReadLine());
                    }

                    else if (n == 6)

                    {
                        WriteLine("Vvod ID: ");
                        string ID = ReadLine();
                        WriteLine("Vvod Data: ");
                        WriteLine("Day: ");
                        int day1 = ToInt32(ReadLine());
                        WriteLine("Month: ");
                        int mont = ToInt32(ReadLine());
                        WriteLine("Year: ");
                        int yea = ToInt32(ReadLine());
                        a.year(ID, day, month, year);
                        WriteLine("Vvod deist: ");
                        n = ToInt32(ReadLine());
                    }
                    else if (n == 7)
                    {
                        WriteLine("Vvod ID: ");
                        string ID = ReadLine();
                        a.initials(ID);
                        WriteLine("Vvod deist: ");
                        n = ToInt32(ReadLine());
                    }
                    else if (n == 8)
                    {
                        WriteLine("Vvod «s» - menshe 18, «a» - starshe 18: ");
                        string param = ReadLine();
                        a.Vozrast(param, day, month, year);
                        WriteLine("Vvod deist: ");
                        n = ToInt32(ReadLine());
                    }
                    else if (n == 9)
                    {
                        WriteLine("Vvod Familia: ");
                        string famil = ReadLine();
                        a.surname(famil);
                        WriteLine("Vvod deist: ");
                        n = ToInt32(ReadLine());
                    }
                }
            }
Example #4
0
        public static void ListOfList()
        {
            var o = new List<List<object>> { new List<object> { 1, 2, 3 }, new List<object> { "aa", 3, "bb" } };
            var s = fastBinaryJSON.BJSON.ToBJSON(o);
            //Console.WriteLine(s);
            var i = fastBinaryJSON.BJSON.ToObject(s);
            var p = new lol { r = o };
            s = fastBinaryJSON.BJSON.ToBJSON(p);
            //Console.WriteLine(s);
            i = fastBinaryJSON.BJSON.ToObject(s);
            Assert.AreEqual(3, (i as lol).r[0].Count);

            var oo = new List<object[]> { new object[] { 1, 2, 3 }, new object[] { "a", 4, "b" } };
            s = fastBinaryJSON.BJSON.ToBJSON(oo);
            //Console.WriteLine(s);
            var ii = fastBinaryJSON.BJSON.ToObject(s);
            lol2 l = new lol2() { r = oo };

            s = fastBinaryJSON.BJSON.ToBJSON(l);
            //Console.WriteLine(s);
            var iii = fastBinaryJSON.BJSON.ToObject(s);
            Assert.AreEqual(3, (iii as lol2).r[0].Length);
        }
 static void Main(string[] args)
 {
     l = null; //does not exist
     myX       //does not exist,
 }
Example #6
0
 private void Start()
 {
     hu       = new lol();
     hu.pren1 = pren;
 }
Example #7
0
 static void Main(string[] args)
 {
     lol x = ...  // THIS WILL CREATE DELEGATE INSTANCE
             x(3) // THIS WILL INVOKE THE DELEGATE
             myX  //does not exist,
 }