Wed Mar 5 19:39:01 CET 2008 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Wed, 5 Mar 2008 17:54:01 +0000 (17:54 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Wed, 5 Mar 2008 17:54:01 +0000 (17:54 -0000)
* Type.cs: optimize GetTypeCode () for the common case
(fixes bug #367354).

svn path=/trunk/mcs/; revision=97421

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/Type.cs

index b38e8ee27d406f2d3d275edf8204495de7a77c61..b875b0898b3f8888f1389be64329fbcf00d00b5d 100644 (file)
@@ -1,3 +1,9 @@
+
+Wed Mar 5 19:39:01 CET 2008 Paolo Molaro <lupus@ximian.com>
+
+       * Type.cs: optimize GetTypeCode () for the common case
+       (fixes bug #367354).
+
 2008-03-02  Roei Erez  <roeie@mainsoft.com>
 
        * DateTime.cs: Improve the patch supplied by James Purcell to be
index b2d1b0bde96cfd3a5748b265826d4a233c8b03d6..03d22c99883fac2b416caf1290e1138b8fb6c8ff 100644 (file)
@@ -488,6 +488,8 @@ namespace System {
                internal extern static TypeCode GetTypeCodeInternal (Type type);
 
                public static TypeCode GetTypeCode (Type type) {
+                       if (type is MonoType)
+                               return GetTypeCodeInternal (type);
                        if (type == null)
                                /* MS.NET returns this */
                                return TypeCode.Empty;
@@ -495,7 +497,7 @@ namespace System {
                        type = type.UnderlyingSystemType;
 
                        if (!type.IsSystemType)
-                               return Type.GetTypeCode (typeof (object));
+                               return TypeCode.Object;
                        else
                                return GetTypeCodeInternal (type);
                }