Needless to say, the code is directly affixed, the specific code is described as follows:
<summary>/////</summary>///<typeparam name= "T" ></typeparam>///<param Name= "origin "> Source data </param>///<param name=" target "> Object data </param>///<param name=" dict "> variable name corresponding dictionary </ Param>public static void Copyto<t> (This object origin, T target,dictionary<string,string> dict) where T: Class,new () {propertyinfo[] props = target. GetType (). GetProperties (); foreach (PropertyInfo info in props) {var variable = Dict. FirstOrDefault (m = M.value = = info. Name); if (variable. Key!=null) {string variableName = variable. key;string chinesename = variable. Value;var PropertyValue =origin. GetType (). GetProperty (VariableName). GetValue (origin, null); if (propertyvalue! = null) {if (Propertyvalue.gettype (). IsClass) {}target. GetType (). InvokeMember (chinesename, BindingFlags.SetProperty, NULL, target,new object[] {propertyvalue});}}}
The above is. NET through the dictionary to assign values to the content of the code, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!