C# .NET - Where is the definition for GetType() function ?
Asked By Nagaraj muthuchamy on 24-Sep-07 08:30 AM
Once we create an object for user defined class, We could see some methods like "getType()","toString()","getHashCode".. are getting defined by default.
1. Where are they defined ?
2. When are they getting defined?
They are inherited - Mike Gorney replied to Nagaraj muthuchamy on 24-Sep-07 08:42 AM
those methods all derive from Object if I am not mistaken.
Where is the definition for GetType() function ? - Nagaraj muthuchamy replied to Mike Gorney on 24-Sep-07 08:55 AM
thanks for reply,
Nomally , A method will be available for an object if we have defined that method in our class .But I have't defined any methods like "getType()"
MSDN - Mike Gorney replied to Nagaraj muthuchamy on 24-Sep-07 08:58 AM
You can find the defenition of all methods and properties on MSDN:
ya, it's there !! - Nagaraj muthuchamy replied to Mike Gorney on 24-Sep-07 10:40 AM
I got what i wanted to know.
GetType() Function - SP replied to Nagaraj muthuchamy on 30-Jun-08 07:14 AM
You need to add the assembly name in for any type that is not in the corrent assembly or mscorlib.
So Type t = Type.GetType("System.Data.DataTable, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
will work (for version 1.1 of the framework - if you're using 1.0 use the version number for that one)
Btw: System.String is not a Value Type, it a Reference Type.
Hope it helps.