I am trying to convert an Object to an Array. When I try to, the converted value sits as null. I am not able to understand why this is happening. Am I missing something?
string argName = argumentName + "1";
var holder = typeof(MyClass).GetProperty(argName);
object valueHolder = holder.GetValue(argName);
string[] test = valueHolder as string[]; //test sits as null where valueHolder seems to be intact.
I resolved this by having an int[]
to hold.
int[] test1 = valueHolder as int[];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.