Esempio n. 1
0
        static void Main(string[] args)
        {
            //People wangzhuo = new People();
            //wangzhuo.Age = 18;
            //People xiaohong = new People();
            //xiaohong.Age = 16;
            //People xiaoming = new People();
            //xiaoming.Age = 13;


            PeopleCurdRepository Database = new PeopleCurdRepository();

            //Database.Add(wangzhuo);
            //Database.Add(xiaohong);
            //Database.Add(xiaoming);


            //序列化
            Console.WriteLine(JsonConvert.SerializeObject(Database.GetAll()));

            ////反序列化
            ///wangzhuo3=wangzhuo;
            ////clone  深拷贝
            //People wangzhuo2 = JsonConvert.DeserializeObject<People>("sadasdsafsadsda");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            People hahaha = new People();

            hahaha.Age = 18;
            People xiaohong = new People();

            xiaohong.Age = 19;
            People ahahaha = new People();

            ahahaha.Age = 15;

            PeopleCurdRepository database = new PeopleCurdRepository(); //step3

            database.Add(hahaha);
            database.Add(xiaohong);
            database.Add(ahahaha);

            Console.WriteLine(JsonConvert.SerializeObject(database.GetAll()));

            //序列化
            //Console.WriteLine(JsonConvert.SerializeObject(hahaha));
            //反序列化
            //People hahaha2 = JsonConvert.DeserializeObject<People>(JsonConvert.SerializeObject(hahaha));//深拷贝
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            PeopleCurdRepository database = new PeopleCurdRepository();

            this.dataGridName1.DataSource = database.GetAll();
        }