Keith J. Farmer wrote:
> http://msdn2.microsoft.com/en-us/library/system.type.gettype.aspx
>
> The C# typeof(typeid) operator doesn't take a string.  Instead, it takes the 
> type identifier and returns an object representing that type.  It's basically 
> a compile-time operation.
>
> The framework's Type.GetType methods are runtime operations that take some 
> input (eg, a string containing the name of a type, or a variable whose type 
> you want to know) and return the appropriate Type object.
>   
Right - so they both just return a type object. The distinction is that 
one is dynamic (runtime) and the other compile time. That much is fine.

It still doesn't explain to me why they are both used in the MSDN 
example, and more to the point why the example doesn't just use the type 
objects in the first place ! (I don't expect you to answer this. :-)

What object does 'typeof(int)' (in C# *not* IronPython) return. I guess 
it is not System.Int32 ! Is there a common base class for the C# number 
types ?

Thanks

Fuzzyman
http://www.voidspace.org.uk/ironpython/


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
> Sent: Saturday, March 10, 2007 5:35 AM
> To: Discussion of IronPython
> Subject: [IronPython] C#, Types and IronPython
>
> Hello all,
>
> Despite my previous email, I still need some help. :-)
>
> I have some C# that is getting at type objects in several different 
> ways, and I would like to know the difference.
>
> Type.GetType("int")
> typeof(int)
>
> and I think :
>
> int.GetType()
>
> What are the differences in semantics between 'typeof(...)' and 
> 'Type.GetType(...)' ?
>
> All the best,
>
> Michael
> http://www.voidspace.org.uk/ironpython/
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to