EventEmitter/EventEmitter.cs
/// <summary>
/// Removes [method] from the event
/// </summary>
/// <param name="eventNames">Event name to remove function from</param>
/// <param name="method">Method to remove from eventName</param>
Removes [method] from the event
Removes [ method ] from the event
public void RemoveListener(string eventNames, Func<string, object?, Task> method)
        {
            _rwl.EnterWriteLock();
            var eventNameList = eventNames.Split(EventSeparator, StringSplitOptions.RemoveEmptyEntries);
            foreach (var eventName in eventNameList)
            {
                if (!_events.TryGetValue(eventName, out var subscribedMethods))
                {
                    throw new DoesNotExistException(string.Format("Event [{0}] does not exist to have listeners removed.", eventName));
                }
                else
                {
                    var _event = subscribedMethods.Exists(e => e == method);
                    if (_event == false)
                    {
                        throw new DoesNotExistException(string.Format("Func [{0}] does not exist to be removed.", method.Method));
                    }
                    else
                    {
                        subscribedMethods.Remove(method);
                    }
                }
            }
            _rwl.ExitWriteLock();
        }
public void RemoveListener ( string eventNames , Func < string , object ? , Task > method ) { _rwl . EnterWriteLock ( ) ; var eventNameList = eventNames . Split ( EventSeparator , StringSplitOptions . RemoveEmptyEntries ) ; foreach ( var eventName in eventNameList ) { if ( ! _events . TryGetValue ( eventName , out var subscribedMethods ) ) { throw new DoesNotExistException ( string . Format ( " " , eventName ) ) ; } else { var _event = subscribedMethods . Exists ( e => e == method ) ; if ( _event == false ) { throw new DoesNotExistException ( string . Format ( " " , method . Method ) ) ; } else { subscribedMethods . Remove ( method ) ; } } } _rwl . ExitWriteLock ( ) ; }
Removes [method] from the event
Removes [ method ] from the event
eventNames
string
Event name to remove function from
Event name to remove function from
method
Func<string, object?, Task>
Method to remove from eventName
Method to remove from eventName