Reflection and Class Properties
I want to know if there is a way I can discover all the Properties I have set up in my class using Reflection or something similiar?
I have Class1 with a property called FirstName, LastName.
I want to be able to loop through all the properties in my class, kind of like a collection. Is that possible?
Thanks
Re: Reflection and Class Properties
Yes it is, assuming that class is in a DLL file. You can open it using Reflection and call the GetProperties() method to pull them out and then loop thru them.
Re: Reflection and Class Properties
E.g.
vb Code:
Dim properties As PropertyInfo() = GetType(Class1).GetProperties()