Re: Testing the 'type' of an Object???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Vladimir Scherbina (vladimir_ns_at_ukr.net)
Date: 02/06/04


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



Relevant Pages

  • Re: Verify a Windows Account
    ... static bool authUserLocal{ ... public class UserLogon {public static extern bool LogonUser(string lpszUsername, string lpszDomain, ... int dwLogonProvider, ...
    (microsoft.public.dotnet.framework)
  • Re: Verify a Windows Account
    ... static bool authUserLocal{ ... public class UserLogon {public static extern bool LogonUser(string lpszUsername, string lpszDomain, ... int dwLogonProvider, ...
    (microsoft.public.dotnet.general)
  • Re: nativeMethod error
    ... private void InitializeComponent() ... public int cmdID; ... bool TopLevelContainer ... string LocationName ...
    (microsoft.public.dotnet.languages.csharp)
  • Gcc compatible header file
    ... A string collection is a table of zero terminated strings that will grow ... typedef struct _StringCollection StringCollection; ... int; ... bool; ...
    (comp.lang.c)
  • XmlSerializer Collection with Collections
    ... public class TestSerializer ... public int AddQuestion(Question question) ... public Question(string QuestionText, string Type, int Score, bool ...
    (microsoft.public.dotnet.xml)