. NET implements code by assigning values to classes through dictionaries, and. net assigns values
If you don't talk much about it, paste the Code directly. The specific code is as follows:
/// <Summary> ///// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "origin "> source data </param> /// <param name =" target "> Object Data </param> /// <param name =" dict "> Dictionary of variable names </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 a small series for you to introduce. NET implements code by assigning values to classes through dictionaries. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner, thank you very much for your support for the help House website!