Browse Source

Implemented SerializableAttribute

svn path=/trunk/mcs/; revision=701
Miguel de Icaza 24 years ago
parent
commit
e30df57f69

+ 4 - 0
mcs/class/corlib/System/ChangeLog

@@ -1,3 +1,7 @@
+2001-09-02  Miguel de Icaza  <[email protected]>
+
+	* MarshalByRefObject.cs: Mark class as [Serializable].
+
 2001-08-28  Dietmar Maurer  <[email protected]>
 
 	* Console.cs: impl. (write only)

+ 4 - 0
mcs/class/corlib/System/MarshalByRefObject.cs

@@ -27,5 +27,9 @@ namespace System {
 		{
 			return null;
 		}
+
+		protected MarshalByRefObject ()
+		{
+		}
 	}
 }

+ 36 - 0
mcs/class/corlib/System/SerializableAttribute.cs

@@ -0,0 +1,36 @@
+//
+// System.SerializableAttribute.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+namespace System {
+
+	/// <summary>
+	///   Serialization Attribute for classes. 
+	/// </summary>
+	
+	/// <remarks>
+	///   Use SerializableAttribute to mark classes that do not implement
+	///   the ISerializable interface but that want to be serialized.
+	///
+	///   Failing to do so will cause the system to throw an exception.
+	///
+	///   When a class is market with the SerializableAttribute, all the
+	///   fields are automatically serialized with the exception of those
+	///   that are tagged with the NonSerializedAttribute.
+	///
+	///   SerializableAttribute should only be used for classes that contain
+	///   simple data types that can be serialized and deserialized by the
+	///   runtime (typically you would use NonSerializedAttribute on data
+	///   that can be reconstructed at any point: like caches or precomputed
+	///   tables). 
+	/// </remarks>
+
+	[AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)]
+	public sealed class SerializableAttribute : Attribute {
+	}
+}

+ 1 - 0
mcs/class/corlib/System/common.src

@@ -69,6 +69,7 @@ Enum.cs
 MulticastDelegate.cs
 ParamArrayAttribute.cs
 RuntimeTypeHandle.cs
+SerializableAttribute.cs
 Type.cs
 TypeInitializationException.cs
 ValueType.cs