How to iterate through each property of a custom object?

How can I go through each of the properties in my custom object? It is not a collection object, but is there something like this for non-collection objects?

For Each entry as String in myObject
    ' Do stuff here...

There are string, integer and boolean properties in my object.


By using reflection you can do that. In C# it looks like that;

PropertyInfo[] propertyInfo = myobject.GetType().GetProperties();

Added a VB.Net translation:

Dim info() As PropertyInfo = myobject.GetType().GetProperties()

Need Your Help

Best way to search through an array and return result

javascript arrays search for-loop

I have an application where you can add peoples firstname, lastname and phonenumber (eg. "new Member('Thomas', 'Jonsson', '0709454543'"). In the application it's possible to show the members on a web

loop over directory and file bash script - awk does not write to file

bash awk find

I would like to traverse through some directories that contain xml files. To each file I would like to apply an awk command and write the output to the file again. The file that is written is empty,

How do I add a value to a TextBox that's inside an ASP:LoginView loginview

I have some DropDownLists and some TextBoxes on a page. Normally I use this to clear and add value to the items: