コード例 #1
0
ファイル: SerializeDemo.xaml.cs プロジェクト: Daoting/dt
        /// <summary>
        /// 传送字符串对
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        async void SendDict(object sender, RoutedEventArgs e)
        {
            Dict dt = new Dict();

            Dict cls = new Dict();

            cls["string"]    = "string value";
            cls["bool"]      = true;
            cls["int"]       = 100;
            cls["long"]      = 123234L;
            cls["double"]    = 1234.456d;
            cls["datetime"]  = DateTime.Now;
            cls["bytearray"] = new byte[] { 10, 12, 14, 16 };
            cls["null"]      = null;
            dt["基本数据类型"]     = cls;

            var tbl = _tbl.Clone();

            tbl.AcceptChanges();
            dt["DataTable"] = tbl;

            dt["字符串列表"] = new List <string>()
            {
                "first", "second"
            };
            dt["bool列表"] = new List <bool>()
            {
                true, false, false, true
            };
            dt["int列表"] = new List <int>()
            {
                100, 123, 432, 78
            };

            OutDict(await AtTest.SendDict(dt));
        }