Esempio n. 1
0
    public void SendNotification <T>(string observeName, T body, Type type)
    {
        EventNotifaction <T> notify = EventNotifaction <T> .Allocate(observeName, body, type);

        NotifyObservers(notify);
        notify.Release();
    }
    //public static int Length { get { return sPool.Length; } }
    /// <summary>
    /// Pulls an object from the pool.
    /// </summary>
    /// <returns></returns>
    public static EventNotifaction <T> Allocate(string ObserverName, T body, Type Type)
    {
        EventNotifaction <T> lInstance = sPool.Allocate();

        if (lInstance == null)
        {
            lInstance = new EventNotifaction <T>();
        }

        lInstance.ObserverName = ObserverName;
        lInstance.Body         = body;
        lInstance.Type         = Type;

        lInstance.IsUsing = true;
        return(lInstance);
    }