Type Comparison

  • Thread starter Thread starter Rlrcstr
  • Start date Start date
R

Rlrcstr

I'm passing an object to a funtion that needs to operate on all the the
member properties of type string.

I know how to iterate through the member properties of the object using
reflection, but I can't figure out how to tell if the type of the property
is a string.

How can I programmatically determine the type of a property? Thanks.

Jerry
 
Rlrcstr said:
I know how to iterate through the member properties of the object using
reflection, but I can't figure out how to tell if the type of the property
is a string.

How can I programmatically determine the type of a property?

\\\
Dim pi As PropertyInfo
....
If pi.PropertyType Is GetType(Foo) Then
...
End If
///
 
Jerry,

You can use Visual Basic's TypeOf keyword in an If statement.

Kerry Moorman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top