How to iterate through each property of a custom vb.net 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...
Next

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

Answers


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

Change VisualState of ListBox element

c# xaml windows-phone-8 visualstatemanager visualstates

I've got a Lisbox in which I've made a ItemsTemplate, in this itemTemplate I've got a element in which I wish to change the visualState, The problem is I do not know how to change the state. Here i...

What do “chunk”, “block”, “offset”, “buffer”, and “sector” mean?

python buffer block chunks sector

I have seen some of the scripts which are either dealing with archive or binary data or copy files (not using python default functions) use chunk or block or offset or buffer or sector.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.