• 大小: 0.23M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: json  转换  C#  

资源简介

json可以将某对象转换为字符串,然后发送给对方。对方收到后直接再转换成对象。推荐Newtonjson这个转换类,

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace NewtonjsonDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnGetJson_Click(object sender EventArgs e)
        {
            User u = new User();
            u.ID = 1;
            u.Name = “Andrew“;
            u.Remark = “www.wxzzz.com“;

            txtGetJson.Text = Newtonsoft.Json.JsonConvert.Serializeobject(u);
        }

        private void btnGetobject_Click(object sender EventArgs e)
        {
            User u = (User)Newtonsoft.Json.JsonConvert.Deserializeobject(txtGet

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      10240  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\bin\Debug\NewtonjsonDemo.exe

     文件      22016  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\bin\Debug\NewtonjsonDemo.pdb

     文件      21464  2015-01-14 10:03  NewtonjsonDemo\NewtonjsonDemo\bin\Debug\NewtonjsonDemo.vshost.exe

     文件        490  2010-03-17 22:39  NewtonjsonDemo\NewtonjsonDemo\bin\Debug\NewtonjsonDemo.vshost.exe.manifest

     文件     491008  2014-07-20 03:26  NewtonjsonDemo\NewtonjsonDemo\bin\Debug\Newtonsoft.Json.dll

     文件     512161  2014-07-20 03:26  NewtonjsonDemo\NewtonjsonDemo\bin\Debug\Newtonsoft.Json.xml

     文件        915  2014-07-20 03:33  NewtonjsonDemo\NewtonjsonDemo\Form1.cs

     文件       4914  2014-07-20 03:31  NewtonjsonDemo\NewtonjsonDemo\Form1.Designer.cs

     文件       5817  2014-07-20 03:31  NewtonjsonDemo\NewtonjsonDemo\Form1.resx

     文件       3922  2014-07-20 03:31  NewtonjsonDemo\NewtonjsonDemo\NewtonjsonDemo.csproj

     文件        789  2015-01-14 10:03  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6301  2015-01-14 10:03  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1890  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.csproj.FileListAbsolute.txt

     文件        847  2014-07-20 03:32  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.csproj.GenerateResource.Cache

     文件       6532  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.csprojResolveAssemblyReference.cache

     文件      10240  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.exe

     文件        180  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.Form1.resources

     文件      22016  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.pdb

     文件        180  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\NewtonjsonDemo.Properties.Resources.resources

     文件        142  2014-07-20 03:26  NewtonjsonDemo\NewtonjsonDemo\packages.config

     文件        475  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\Program.cs

     文件       1352  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\Properties\AssemblyInfo.cs

     文件       2880  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\Properties\Resources.Designer.cs

     文件       5612  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\Properties\Resources.resx

     文件       1101  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\Properties\Settings.Designer.cs

     文件        249  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\Properties\Settings.settings

     文件        267  2015-01-14 10:06  NewtonjsonDemo\NewtonjsonDemo\User.cs

     文件       1011  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo.sln

    ..A..H.     22528  2015-01-14 10:14  NewtonjsonDemo\NewtonjsonDemo.v11.suo

     目录          0  2014-07-20 03:24  NewtonjsonDemo\NewtonjsonDemo\obj\Debug\TempPE

............此处省略10个文件信息

评论

共有 条评论