public ActionResult Base(UserModel Model) { Model.Tel = string.Format("{0}-{1}", Model.Areacode, Model.Tel); Model.Fax = string.Format("{0}-{1}", Model.Areacode, Model.Fax); Model.UserTypeID = Convert.ToInt16(ControllerContext.RouteData.Values["id"]); foreach (System.Reflection.PropertyInfo info in typeof(UserModel).GetProperties()) { try { log.Info((info.Name + " " + info.GetValue(Model, null).ToString())); } catch(Exception e) { log.Error(string.Format("错误字段:{0}", info.Name), e); } } return View(); }
利用反射获取Model值
猜你喜欢
转载自www.cnblogs.com/superfeeling/p/9177319.html
今日推荐
周排行