Catel.MVVM.CompositeCommand.UnregisterAction C# (CSharp) Method

UnregisterAction() public method

Unregisters the specified action.
The is null.
public UnregisterAction ( System.Action action ) : void
action System.Action The action.
return void
        public void UnregisterAction(Action action)
        {
            Argument.IsNotNull("action", action);

            lock (_lock)
            {
                for (var i = _actions.Count - 1; i >= 0; i--)
                {
                    // Check for both ReferenceEquals (original implementation) and == (to fix CTL-654)
                    if (ReferenceEquals(_actions[i], action) || _actions[i] == action)
                    {
                        _actions.RemoveAt(i);

                        Log.Debug("Unregistered action from CompositeCommand");
                    }
                }
            }
        }

Same methods

CompositeCommand::UnregisterAction ( Action action ) : void

Usage Example

Ejemplo n.º 1
0
            public void ThrowsArgumentNullExceptionForNullAction()
            {
                var compositeCommand = new CompositeCommand();

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => compositeCommand.UnregisterAction((Action<object>)null));
            }
All Usage Examples Of Catel.MVVM.CompositeCommand::UnregisterAction