C# 中 DapperRow 数据解析

【C# 中 DapperRow 数据解析】满堂花醉三千客,一剑霜寒十四州。这篇文章主要讲述C# 中 DapperRow 数据解析相关的知识,希望能为你提供帮助。

using Newtonsoft.Json; List< DataColumnModel> lstColumn = new List< DataColumnModel> () { new DataColumnModel { ColumnName = "Name", ColumnCaption = "部门名称", ColumnType = typeof(string) }, new DataColumnModel { ColumnName = "Value", ColumnCaption = "小计", ColumnType = typeof(int) } }; string json = JsonConvert.SerializeObject(data.rows); JArray jArray = (JArray)JsonConvert.DeserializeObject(json); JToken jObj = (JToken)jArray[0]; foreach (JProperty jp in jObj) { string name = jp.Name; if (name != "Name" & & name != "OrgId" & & name != "Value") { DataColumnModel col = new DataColumnModel(); col.ColumnName = name; col.ColumnCaption = name; col.ColumnType = typeof(int); lstColumn.Add(col); } }


    推荐阅读