vagueante
Active member
Whats the best way to iteract through a class to get all the properties names?
So far i have this code
My problem is: I will receive a xml file, and have to get the data in a class, but as mentioned before the class has a lot of classes as properties, and i want do do it without hardcode, I want to loop the class properties names and compare them to the xml tags (it haves the same name as the class properties), and put the values from the xml file in an instance object of the class.
Any help?
So far i have this code
VB.NET:
Dim classInstance As New ServiceReference1.draftClaimEntryDefinition
For Each PropertyItem As PropertyInfo In classInstance.GetType().GetProperties()
Dim strPropName As String = String.Empty
strPropName = PropertyItem.Name
Next
My problem is: I will receive a xml file, and have to get the data in a class, but as mentioned before the class has a lot of classes as properties, and i want do do it without hardcode, I want to loop the class properties names and compare them to the xml tags (it haves the same name as the class properties), and put the values from the xml file in an instance object of the class.
Any help?