PC Review


Reply
Thread Tools Rate Thread

Comparing types

 
 
Mike J
Guest
Posts: n/a
 
      8th May 2007
Hi..need help comparing types
example method

istypeof(object someobj)
{
if (someobj=int32)
}

ya kinda get my idea here....
MJ



 
Reply With Quote
 
 
 
 
Alberto Poblacion
Guest
Posts: n/a
 
      8th May 2007
"Mike J" <(E-Mail Removed)> wrote in message
news:AK20i.1952$(E-Mail Removed)...
> Hi..need help comparing types
> example method
>
> istypeof(object someobj)
> {
> if (someobj=int32)
> }


You can use the operator "is":

if (someobj is Int32) ....

Note that if you try this with a class instead of an int32, the
condition will be true not only if the object is of that class, but also if
it is of an inherited class.

 
Reply With Quote
 
John Vottero
Guest
Posts: n/a
 
      8th May 2007
"Mike J" <(E-Mail Removed)> wrote in message
news:AK20i.1952$(E-Mail Removed)...
> Hi..need help comparing types
> example method
>
> istypeof(object someobj)
> {
> if (someobj=int32)
> }
>


if (someobj is Int32)

or

if (someobj.GetType() == typeof(Int32))

depending one what you really mean by "comparing types".


 
Reply With Quote
 
Mike J
Guest
Posts: n/a
 
      9th May 2007
Thank you much
MJ

"Mike J" <(E-Mail Removed)> wrote in message
news:AK20i.1952$(E-Mail Removed)...
> Hi..need help comparing types
> example method
>
> istypeof(object someobj)
> {
> if (someobj=int32)
> }
>
> ya kinda get my idea here....
> MJ
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Types derek Microsoft C# .NET 5 23rd Dec 2004 05:13 PM
Comparing Types =?Utf-8?B?RGVubmlz?= Microsoft VB .NET 3 21st Nov 2004 06:22 PM
Comparing Empty Value types =?Utf-8?B?RGVubmlz?= Microsoft VB .NET 19 18th Nov 2004 05:12 PM
Comparing types. Chris Blanco Microsoft C# .NET 3 5th Aug 2003 03:53 PM
Is there any where I can see a grid comparing SQL Types to system Types? Nick Microsoft ADO .NET 2 4th Jul 2003 02:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:16 AM.