lundi 2 février 2015

vb.net/reflection: convert PropertyInfo which is string and numeric to PropertyInfo Int32

I have two clases:



public class A
public id as string = "123"
end class

public class B
public id as integer
end class


I am getting a new class B from A using reflection.


If Id in both clases is Int32, it is correct, but if in A class is String and numeric, not working. Obiously types are different.


The code I am using from Int32 to Int32 is:



pInfo2.SetValue(copiedObject, pInfo1.GetValue(source, nothing), nothing)


How can I change the string type to Int32 in the reflection code?






Aucun commentaire:

Enregistrer un commentaire