473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Type Comparison

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
Nov 21 '05 #1
2 5105
"Rlrcstr" <rl*****@msn.com> schrieb:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Jerry,

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

Kerry Moorman
"Rlrcstr" wrote:
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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Simon Burton | last post by:
In today's experiment, I was wondering if I could make the comparison operators (<,<=,>=,>) work on classes (types) according to inheritance. The idea is, for example, classes lower in the class...
7
by: Spencer Wasden | last post by:
I want to determine if a control on a form is a TextBox type. I would like to do something like the following WITHOUT doing a string comparison. foreach (Control c in this.Controls){ if...
10
by: Chris Morse | last post by:
Hi, I'm trying to figure out how to dynamically load an assembly and get an IClientPlugin interface to a class. I can get an "Object" reference to it after doing an "Activator.CreateInstance"...
37
by: spam.noam | last post by:
Hello, Guido has decided, in python-dev, that in Py3K the id-based order comparisons will be dropped. This means that, for example, "{} < " will raise a TypeError instead of the current...
1
by: shsandeep | last post by:
One of my query is comparing 2 columns in a 'where' clause: COL1 CHAR(3) and COL2 CHAR(8). Is there any overhead involved in performance as compared to if both datatypes are CHAR(8)? Its...
1
by: borris | last post by:
ive been trying to do a test for type with wxpython objects like passing in a wx.TextCtrl into def XXX(obj) if type(obj) is type(self.Button) I have to make an object self.Button to get...
18
by: Alan G Isaac | last post by:
>>None >= 0 False True Explanation appreciated. Thanks, Alan Isaac
2
by: puzzlecracker | last post by:
Unlike C++, in Csharp you're only allowed to compare a generic type T with null, if the method it's passed in not implementing IComparable<Tor , IEquatable<T(still don't know why we need these...
12
by: Joe Strout | last post by:
On Nov 12, 2008, at 10:45 AM, Tim Rowe wrote: Because if I write a method with the intention of treating the arguments like strings in various ways (slicing, combining with other strings,...
2
!NoItAll
by: !NoItAll | last post by:
I have a ListOf(Type that I've created that will often have well over 20-thousand entries. The type I am placing into the list looks like this: Structure MyType Dim FileName as String ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.