C# Delegate 4.7.1-api

C# 委託


#region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// D:\Unity2018.2.7f1\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\mscorlib.dll
#endregion

using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;

namespace System
{
    [ClassInterface(ClassInterfaceType.AutoDual)]
    [ComVisible(true)]
    public abstract class Delegate : ICloneable, ISerializable
    {
        [SecuritySafeCritical]
        protected Delegate(object target, string method);
        [SecuritySafeCritical]
        protected Delegate(Type target, string method);

        public MethodInfo Method { get; }
        public object Target { get; }

        [ComVisible(true)]
        public static Delegate Combine(params Delegate[] delegates);
        public static Delegate Combine(Delegate a, Delegate b);
        [SecuritySafeCritical]
        public static Delegate CreateDelegate(Type type, Type target, string method, bool ignoreCase, bool throwOnBindFailure);
        public static Delegate CreateDelegate(Type type, Type target, string method);
        [SecuritySafeCritical]
        public static Delegate CreateDelegate(Type type, MethodInfo method, bool throwOnBindFailure);
        public static Delegate CreateDelegate(Type type, MethodInfo method);
        public static Delegate CreateDelegate(Type type, Type target, string method, bool ignoreCase);
        public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase);
        public static Delegate CreateDelegate(Type type, object target, string method);
        [SecuritySafeCritical]
        public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method, bool throwOnBindFailure);
        public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method);
        [SecuritySafeCritical]
        public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure);
        [SecuritySafeCritical]
        public static Delegate Remove(Delegate source, Delegate value);
        public static Delegate RemoveAll(Delegate source, Delegate value);
        public virtual object Clone();
        public object DynamicInvoke(params object[] args);
        [SecuritySafeCritical]
        public override bool Equals(object obj);
        public override int GetHashCode();
        public virtual Delegate[] GetInvocationList();
        [SecurityCritical]
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context);
        protected virtual Delegate CombineImpl(Delegate d);
        [SecuritySafeCritical]
        protected virtual object DynamicInvokeImpl(object[] args);
        [SecuritySafeCritical]
        protected virtual MethodInfo GetMethodImpl();
        protected virtual Delegate RemoveImpl(Delegate d);

        public static bool operator ==(Delegate d1, Delegate d2);
        public static bool operator !=(Delegate d1, Delegate d2);
    }
}

移除方法:移除之後,下一次需要重新訂閱


GameData.GameStateCallback = (ClientData<GameState>)Delegate.RemoveAll(GameData.GameStateCallback, GameData.GameStateCallback);

public delegate void ClientData<T>(T data);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章