恩大概就是看到這個類裏面這些縮了的代碼段居然是中文標示感受有點屌炸天json
要實現這種效果只要添上#region標籤對就行了c#
好比咱們看公共字段那裏this
public class ServiceBase : System.Web.UI.Page { #region 公共字段 protected string _errorMsg; #endregion #region 私有方法 /// <summary> /// 將數據Response到服務請求端 /// </summary> /// <param name="data"></param> void responseData(object data) { try { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"; //構造返回結果的 jason數據 String json = JsonConvert.SerializeObject(data, timeConverter); Response.Write(Server.HtmlDecode(json)); } catch (Exception ex) { this.Log(ex, "序列化失敗"); JsonDataReturn error = new JsonDataReturn(); error.isSuccess = false; error.resultMsg = ex.Message; Response.Write(HttpUtility.UrlDecode(JsonConvert.SerializeObject(error), Encoding.UTF8)); } } #endregion
注意code
#region 公共字段 protected string _errorMsg; #endregion
#region和#endregion對orm
就這樣 恩string