C# 转json
#region MyRegion StringBuilder sb = new StringBuilder(); sb.Append("{"); foreach (System.Reflection.PropertyInfo p in model.GetType().GetProperties()) { var ss = p.Name; //属性名称 if (ss == "Role" || ss == "Department" || ss == "ApplySolver") { continue; } var s1 = p.GetValue(model);//属性值 sb.AppendFormat("\"{0}\":\"{1}\"", ss, s1); sb.Append(","); } sb.Remove(sb.Length - 1, 1); sb.Append("}"); desc = sb.ToString(); sb.Length = 0; #endregion