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
{
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));
}
return GetFunctionPointer (value);
}
-#if NET_2_0
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
public override bool Equals (object obj)
{
{
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;
+ }
}
}