public void Deserialize() { if (!Param.IsNullOrEmpty()) { ParamList.AddRange(JsonConvert.DeserializeObject <List <string> >(Param)); } if (!OtherParam.IsNullOrEmpty()) { OtherParamList.AddRange(JsonConvert.DeserializeObject <List <object> >(OtherParam)); } }
public void A() { var target = new Target(); var p = new Param(); var p2 = new OtherParam(); object x = new Param(); target.M(p); target.M(p2); target.M(x); target.M(p, p2); target.M(x, x); }
public bool AddPlug4Configure(string id, string AreaIds, string ExcludeAreaIds, int priority, string OtherSections) { JavaScriptSerializer jss = new JavaScriptSerializer(); var Sections = jss.Deserialize <List <JZHSection> >(OtherSections); var areaids = AreaIds.Split(new char[] { ',', ',' }); var eareaids = ExcludeAreaIds.Split(new char[] { ',', ',' }); OtherParam param = new OtherParam { AreaIds = areaids.ToList().Select(x => int.Parse(x)).ToList(), ExcludeAreaIds = eareaids.ToList().Select(x => int.Parse(x)).ToList(), Priority = priority, OtherSections = Sections }; var plug = AdminCarriageClient.Instance.GetPlugConfigure(4); var ret = jss.Deserialize <Myzj.OPC.UI.Model.AdminCarriage._OtherParams>(plug); ret.OtherParams.Add(param); return(AdminCarriageClient.Instance.UpdatePlugConfigure(4, jss.Serialize(ret))); }
public ActionResult Detail4Operation(int rowindex = -1) { var plug = AdminCarriageClient.Instance.GetPlugConfigure(4); JavaScriptSerializer jss = new JavaScriptSerializer(); var ret = jss.Deserialize <_OtherParams>(plug); OtherParam param = new OtherParam(); if (rowindex >= 0) { param = ret.OtherParams[rowindex]; } else { param.Priority = 1; param.AreaIds = new List <int>(); param.ExcludeAreaIds = new List <int>(); param.OtherSections = new List <JZHSection>(); } ViewBag.rowindex = rowindex; return(View(param)); }