public void Invoke(MessageAttribute attribute, MessageArgs param) { if (param == null) { throw new ArgumentNullException(); } if (attribute.ArgumentType != param.GetType()) { throw new ArgumentException("Invalid parameter argument type"); } List<MessageInfo> callList = GetEventList(attribute.GetType()); // Clean callList.RemoveAll(val => !val.IsAlive); bool allAlive = true; foreach (MessageInfo item in callList) { allAlive &= item.Call(param); } // Clean if (!allAlive) { callList.RemoveAll(val => !val.IsAlive); } }
public void Invoke(MessageAttribute attribute) { Invoke(attribute, MessageArgs.Empty); }