No more nonsense, directly affixed to the code, the specific code described below:
///<summary>//////</summary>///<typeparam name= "T" ></typep aram>///<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 described in small series for you. NET through the dictionary to the class assignment code to achieve, I hope to help you, if you have any questions welcome to my message, small series will promptly reply to everyone, here also thank you for your support cloud Habitat community site!