using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PLC_Communication
{
    /// <summary>
    /// Json测试
    /// </summary>
    public class JsonTest 
    {
        public void Run()
        {
            PLC_Retured_value Retured_value = new PLC_Retured_value();
            Retured_value.Adress = "";
            Retured_value.Value = "";

            //实体序列化和反序列化
            string json1 = JsonHelper.SerializeObject(Retured_value);

            PLC_Retured_value Retured_value_Read = JsonHelper.DeserializeJsonToObject<PLC_Retured_value>(json1);

            //实体集合序列化和反序列化
            List<PLC_Retured_value> Retured_v = new List<PLC_Retured_value>() { Retured_value };
            string json2 = JsonHelper.SerializeObject(Retured_v);
            //json: [{"ID":1,"Name":"陈晨","NickName":"石子儿"}]
            List<PLC_Retured_value> Retured_v2 = JsonHelper.DeserializeJsonToList<PLC_Retured_value>(json2);
        }

    }
    
    /// <summary>
    /// 信息实体
    /// </summary>
    public class PLC_Retured_value
    {
        public string Adress { get; set; }
        public string Value { get; set; }
       // public string NickName { get; set; }
       // public Class Class { get; set; }
    }

    public class Lic_Retured_value
    {
        public string Licence_Num { get; set; }
        public string Image_path { get; set; }

        public string Time_income { get; set; }

        // public string NickName { get; set; }
        // public Class Class { get; set; }
    }

    /// <summary>
    /// 数据实体
    /// </summary>
    public class Class
    {
        public string ID { get; set; }
        public string Value { get; set; }
    }
}
