Re: Testing the 'type' of an Object???
From: Vladimir Scherbina (vladimir_ns_at_ukr.net)
Date: 02/06/04
- Next message: Joe Mayo [C# MVP]: "Re: MS C# standards strategy"
- Previous message: Sami Vaaraniemi: "Re: modular application"
- In reply to: Darryn Ross: "Testing the 'type' of an Object???"
- Next in thread: Jon Skeet [C# MVP]: "Re: Testing the 'type' of an Object???"
- Reply: Jon Skeet [C# MVP]: "Re: Testing the 'type' of an Object???"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 6 Feb 2004 15:28:08 +0200
object a = "test" ;
object b = 1 ;
object c = true ;
if (a.GetType() == typeof(string))
{
}
else if (b.GetType() == typeof(int32))
{
}
else if (c.GetType() == typeof(bool))
{
}
Vladimir Scherbina,
Ukraine, Kiev.
"Darryn Ross" <darryn@datawave.com.au> wrote in message news:uydGzdG7DHA.1636@TK2MSFTNGP12.phx.gbl...
Hi...
I am not sure how to test the type of an object that i define
object a = "test" ;
object b = 1 ;
object c = true ;
how do i test each of the three objects to find out what types they are.. e.g string, int, bool???
Regards
- Next message: Joe Mayo [C# MVP]: "Re: MS C# standards strategy"
- Previous message: Sami Vaaraniemi: "Re: modular application"
- In reply to: Darryn Ross: "Testing the 'type' of an Object???"
- Next in thread: Jon Skeet [C# MVP]: "Re: Testing the 'type' of an Object???"
- Reply: Jon Skeet [C# MVP]: "Re: Testing the 'type' of an Object???"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|