Loop through custom class

I would like to be able to loop through a custom class and be able to get the names of the properties in it. Is there a way to do this similar to a table schema. I have not been able to find any info on this searching the help. Thanks.

Use this inside your class or you can use it outside your class with a little modification.

Dim myProperties() As Introspection.PropertyInfo = Introspection.GetType(Me).GetProperties For Each pi As Introspection.PropertyInfo In myProperties() system.DebugLog(pi.Name) Next

I would be using this outside of the class. Not sure how or where to use this inside of a class.

You could implement a method to expose the information you require outside the class, like a string array of names of params for example, plenty of options, it depends what you need, it might be neater to implement it like this than putting all this code outside but its up to you :slight_smile:

To use it outside just change Me to the variable with a type of your class.

[code]Dim c As New Class1

Dim myProperties() As Introspection.PropertyInfo = Introspection.GetType©.GetProperties
For Each pi As Introspection.PropertyInfo In myProperties()
system.DebugLog(pi.Name)
Next[/code]

This worked beautifully. Thank you so much for your help! this solved a big problem for me.