Forráskód Böngészése

Mon Jun 30 19:12:08 CEST 2003 Paolo Molaro <[email protected]>

	* Pointer.cs: implemented.

svn path=/trunk/mcs/; revision=15775
Paolo Molaro 22 éve
szülő
commit
54fa4e6c88

+ 5 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,8 @@
+
+Mon Jun 30 19:12:08 CEST 2003 Paolo Molaro <[email protected]>
+
+	* Pointer.cs: implemented.
+
 2003-06-15  Zoltan Varga  <[email protected]>
 
 	* EventInfo.cs: Implement IsSpecialName.

+ 55 - 0
mcs/class/corlib/System.Reflection/Pointer.cs

@@ -0,0 +1,55 @@
+//
+// System.Reflection/Pointer.cs
+//
+// Author:
+//   Paolo Molaro ([email protected])
+//
+// (C) 2003 Ximian, Inc.  http://www.ximian.com
+//
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+
+namespace System.Reflection {
+
+	[Serializable]
+	[CLSCompliant(false)]
+	public unsafe sealed class Pointer : ISerializable {
+
+		void *data;
+		Type type;
+
+		private Pointer () {
+		}
+		
+		public static Pointer Box (void *ptr, Type type) 
+		{
+
+			if (type == null)
+				throw new ArgumentNullException ("type");
+			if (!type.IsPointer)
+				throw new ArgumentException ("type");
+			Pointer res = new Pointer ();
+			res.data = ptr;
+			res.type = type;
+			return res;
+		}
+
+		public static void* Unbox (object ptr)
+		{
+			Pointer p = ptr as Pointer;
+			if (p == null)
+				throw new ArgumentException ("ptr");
+			return p.data;
+		}
+
+		void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+		{
+			throw new NotSupportedException ("Pointer deserializatioon not supported.");
+		}
+	}
+}

+ 1 - 0
mcs/class/corlib/unix.args

@@ -341,6 +341,7 @@ System.Reflection/MonoProperty.cs
 System.Reflection/ParameterAttributes.cs
 System.Reflection/ParameterInfo.cs
 System.Reflection/ParameterModifier.cs
+System.Reflection/Pointer.cs
 System.Reflection/PropertyAttributes.cs
 System.Reflection/PropertyInfo.cs
 System.Reflection/ReflectionTypeLoadException.cs