[IronPython] How to get the Type of object

Thane thane at magna-capital.com
Thu Sep 9 00:09:45 CEST 2004

There are a couple of ways to do this, but my preference is to use Python's
"type()" function.  (Similar to GetType() -- see output below.)

>>> a = 'asdf'
>>> GetType(a)
>>> type(a)
<type 'str'>
>>> from System.Text import *
>>> obj = StringBuilder()
>>> type(obj)
<type 'System.Text.StringBuilder'>
>>> GetType(obj)

-----Original Message-----
From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Sent: Wednesday, September 08, 2004 4:31 AM
To: users-ironpython.com at lists.ironpython.com
Subject: [IronPython] How to get the Type of object

I would like to know is there any way to get the type of the object.
Actaully my requirement is

      1. First i'll create a object for any C#/.Net Datatype (for example
obj = StringBuilder())
	2. Second i may create any other objects are do some operations.
	3. Now, On typing obj(in a taxtbox) and clicking on a button i have
identify the ObjectType to which it belongs

users-ironpython.com mailing list
users-ironpython.com at lists.ironpython.com

More information about the Ironpython-users mailing list