Type Type=typeof (JiChuKu);
Var Properties=the GetProperties ();
Var des=the GetProperty (" attribute name ");
Des. SetValue (jckCurrentKong, attribute values, null);
Met today,
If the attribute value is a string, value, the above code no problem;
But if the attribute value is a bool type, how to also pass ah,
Try the following methods are not
des. SetValue (jckCurrentKong, false. The ToString (), null);
des. SetValue (jckCurrentKong, "false", null);
des. SetValue (jckCurrentKong, 0, null);
Please solve the
There is another problem, very confused, so simple of a problem, baidu search for nearly two hours, just didn't find similar questions...
CodePudding user response:
Value directly with false/trueCodePudding user response:
Des. SetValue (jckCurrentKong, false, null); Have a tryCodePudding user response:
System. Reflection. PropertyInfo info=the GetProperty (key);
Info. SetValue (obj, false, null);