public void RemoveDelegate(CVarChangedDelegate del) { if (del != null && m_delegateList != null) { m_delegateList.Remove(del); if (m_delegateList.Count == 0) { m_delegateList = null; } } }
public void AddDelegate(CVarChangedDelegate del) { if (del == null) { throw new ArgumentNullException("del"); } if (m_delegateList == null) { m_delegateList = new CVarChangedDelegateList(1); m_delegateList.Add(del); } else if (!m_delegateList.Contains(del)) { m_delegateList.Add(del); } }
public void RemoveDelegates(object target) { if (target != null && m_delegateList != null) { for (int i = m_delegateList.Count - 1; i >= 0; --i) { if (m_delegateList.Get(i).Target == target) { m_delegateList.RemoveAt(i); } } if (m_delegateList.Count == 0) { m_delegateList = null; } } }