X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem%2FRuntimeMethodHandle.cs;h=1a3edeeb16e4b8a18f4709466c902c72d12420da;hb=438e3b5ac335f69a620d2db738626fca1d0c2980;hp=bff94af25a8a51815e0bf7430856adbc0015fe2f;hpb=a8b22e0e864c03b8cfd2f2cb5a8075b6611c5553;p=mono.git diff --git a/mcs/class/corlib/System/RuntimeMethodHandle.cs b/mcs/class/corlib/System/RuntimeMethodHandle.cs index bff94af25a8..1a3edeeb16e 100644 --- a/mcs/class/corlib/System/RuntimeMethodHandle.cs +++ b/mcs/class/corlib/System/RuntimeMethodHandle.cs @@ -33,17 +33,12 @@ using System.Runtime.Serialization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Permissions; - -#if NET_2_0 using System.Runtime.ConstrainedExecution; -#endif +using System.Text; namespace System { -#if NET_2_0 [ComVisible (true)] -#endif - [MonoTODO ("Serialization needs tests")] [Serializable] public struct RuntimeMethodHandle : ISerializable { @@ -77,6 +72,9 @@ namespace System if (info == null) throw new ArgumentNullException ("info"); + if (value == IntPtr.Zero) + throw new SerializationException ("Object fields may not be properly initialized"); + info.AddValue ("MethodObj", (MonoMethod) MethodBase.GetMethodFromHandle (this), typeof (MonoMethod)); } @@ -89,7 +87,6 @@ namespace System return GetFunctionPointer (value); } -#if NET_2_0 [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)] public override bool Equals (object obj) { @@ -119,6 +116,24 @@ namespace System { return !left.Equals (right); } -#endif + + internal static string ConstructInstantiation (RuntimeMethodInfo method, TypeNameFormatFlags format) + { + var sb = new StringBuilder (); + var gen_params = method.GetGenericArguments (); + sb.Append ("["); + for (int j = 0; j < gen_params.Length; j++) { + if (j > 0) + sb.Append (","); + sb.Append (gen_params [j].Name); + } + sb.Append ("]"); + return sb.ToString (); + } + + internal bool IsNullHandle () + { + return value == IntPtr.Zero; + } } }