X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Reflection%2FMonoEvent.cs;h=876de83bff0a9c2a5758d2d4f3babd590c34e9b9;hb=95f0800520afb6d7f28eba2178ae3b7c1d104c00;hp=4f354d0a6f7cca75b475c405df3ba0ef370d2abc;hpb=ae3b35aa23f89afc78957b808ee8112b3670c8c7;p=mono.git diff --git a/mcs/class/corlib/System.Reflection/MonoEvent.cs b/mcs/class/corlib/System.Reflection/MonoEvent.cs index 4f354d0a6f7..876de83bff0 100644 --- a/mcs/class/corlib/System.Reflection/MonoEvent.cs +++ b/mcs/class/corlib/System.Reflection/MonoEvent.cs @@ -36,6 +36,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; +using System.Diagnostics.Contracts; namespace System.Reflection { @@ -60,9 +61,56 @@ namespace System.Reflection { } } + abstract class RuntimeEventInfo : EventInfo, ISerializable + { + internal BindingFlags BindingFlags { + get { + return 0; + } + } + + public override Module Module { + get { + return GetRuntimeModule (); + } + } + + internal RuntimeType GetDeclaringTypeInternal () + { + return (RuntimeType) DeclaringType; + } + + RuntimeType ReflectedTypeInternal { + get { + return (RuntimeType) ReflectedType; + } + } + + internal RuntimeModule GetRuntimeModule () + { + return GetDeclaringTypeInternal ().GetRuntimeModule (); + } + + #region ISerializable + public void GetObjectData(SerializationInfo info, StreamingContext context) + { + if (info == null) + throw new ArgumentNullException("info"); + Contract.EndContractBlock(); + + MemberInfoSerializationHolder.GetSerializationInfo( + info, + Name, + ReflectedTypeInternal, + null, + MemberTypes.Event); + } + #endregion + } + [Serializable] [StructLayout (LayoutKind.Sequential)] - internal sealed class MonoEvent: EventInfo, ISerializable + internal sealed class MonoEvent: RuntimeEventInfo { #pragma warning disable 169 IntPtr klass; @@ -158,13 +206,6 @@ namespace System.Reflection { return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit); } - // ISerializable - public void GetObjectData (SerializationInfo info, StreamingContext context) - { - MemberInfoSerializationHolder.Serialize (info, Name, ReflectedType, - ToString(), MemberTypes.Event); - } - public override IList GetCustomAttributesData () { return CustomAttributeData.GetCustomAttributes (this); }