ObjectReader.cs, ObjectWriter.cs: Changed some GetType calls to "is" checks.
[mono.git] / mcs / class / corlib / System.Runtime.Serialization.Formatters.Binary / ObjectWriter.cs
index 73a03d2b4eb7a2a567b0db3a2cb6690de98f3b25..376b7fc1fce34e4c0cb88a99f68bb9817a02c465 100644 (file)
@@ -93,10 +93,10 @@ namespace System.Runtime.Serialization.Formatters.Binary
                        if (isValueObject) id = _idGenerator.NextId;\r
                        else id = _idGenerator.GetId (obj, out firstTime);\r
 \r
-                       if (obj.GetType() == typeof(string)) {\r
+                       if (obj is string) {\r
                                WriteString (writer, id, (string)obj);\r
                        }\r
-                       else if (obj.GetType().IsArray) {\r
+                       else if (obj is Array) {\r
                                WriteArray (writer, id, (Array)obj);\r
                        }\r
                        else\r
@@ -504,7 +504,7 @@ namespace System.Runtime.Serialization.Formatters.Binary
                                // Value types are written embedded in the containing object\r
                                WriteObjectInstance (writer, val, true);\r
                        }\r
-                       else if (val.GetType() == typeof(string))\r
+                       else if (val is string)\r
                        {\r
                                // Strings are written embedded, unless already registered\r
                                bool firstTime;\r