|
-
Jul 2nd, 2007, 02:35 PM
#1
Thread Starter
Member
[RESOLVED] for each property in myclassname?
Want to do a simple bit of code that will help me debug some custom classes I'm building, but I can't figure out how to do it.
All I want to do is console.writeline every property in a class... something like:
Code:
dim prop as Property
dim myclass as new myclassname
for each prop in myclass
console.writeline prop.name
console.writeline prop.value
next
Spent two hours searching so far, just easier to ask. Thanks.
-
Jul 2nd, 2007, 02:39 PM
#2
Re: for each property in myclassname?
If you look in the System.Interop.Reflection namespace there's a bunch of useful classes for dissecting and enumerating the properties of a class....
e.g.
Code:
Dim DataObjectProperties() As PropertyInfo = MyObject.GetType.GetProperties()
(Where MyObject is the thingy you want to enumerate)
Last edited by Merrion; Jul 2nd, 2007 at 02:40 PM.
Reason: I keep forgetting the vb tag doesnae work...
-
Jul 3rd, 2007, 12:03 PM
#3
Thread Starter
Member
Re: for each property in myclassname?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|