\r
public static bool IsPrimitive (Type type)\r
{\r
- return type.IsPrimitive || \r
+ return (type.IsPrimitive && type != typeof (IntPtr)) || \r
type == typeof (DateTime) || \r
type == typeof (TimeSpan) || \r
type == typeof (Decimal);\r
{\r
return _typeCodesToType [code];\r
}\r
+ \r
+ public static void CheckSerializable (Type type, ISurrogateSelector selector, StreamingContext context)\r
+ {\r
+ if (!type.IsSerializable && !type.IsInterface) \r
+ {\r
+ if (selector != null && selector.GetSurrogate (type, context, out selector) != null)\r
+ return;\r
+\r
+ throw new SerializationException ("Type " + type + " is not marked as Serializable.");\r
+ }\r
+ }\r
}\r
\r
internal enum BinaryElement : byte\r