.net - PropertyInfo.SetValue on a property List(Of Int32) -
.net - PropertyInfo.SetValue on a property List(Of Int32) -
i have class list properties this:
public class listpropertiesclass public property id list(of int32) end class
and class utilize reflection :
public class test public sub mysub() dim identityvalue int32 = 100 dim propertyname string = "id" dim lpc new listpropertiesclass dim pinfo propertyinfo pinfo = lpc.gettype().getproperty(propertyname) if not pinfo nil pinfo.setvalue(lpc, convert.toint32(identityvalue), nothing) end if end sub end class
but when seek utilize not working because i'm trying set value of type int32 list one, how can utilize propertyinfo.setvalue add together list itens ? , after adding how can value using reflection value of specific index of list
pinfo.getvalue(lpc, nothing)
i happy if can help me. thanks.
you have first value of current property (and check it) below
this illustration don't remember exact syntax of vb.net
dim pvalue = pinfo.getvalue(lpc, nothing) dim castedvalue list(of integer) = trycast(pvalue, list(of integer)) if castedvalue nil castedvalue = new list(of integer)() end if castedvalue.add(identityvalue) pinfo.setvalue(lpc, convert.toint32(identityvalue), nothing)
.net vb.net system.reflection
Comments
Post a Comment