2008-06-28 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / System.Data / System.Data / DataTable.cs
index 1a21da340cb2d778343b3121c83967cdf6d29de5..f1dbbb3e81ff99302393a5daa06f80e7d8e5a7e6 100644 (file)
@@ -2013,7 +2013,12 @@ namespace System.Data {
                /// </summary>\r
                protected internal DataRow[] NewRowArray (int size) \r
                {\r
-                       return (DataRow[]) Array.CreateInstance (GetRowType (), size);\r
+                       Type t = GetRowType ();\r
+                       /* Avoid reflection if possible */\r
+                       if (t == typeof (DataRow))\r
+                               return new DataRow [size];\r
+                       else\r
+                               return (DataRow[]) Array.CreateInstance (GetRowType (), size);\r
                }\r
 \r
                /// <summary>\r