METHOD

ICommand.Execute

Invokes the command action with its parameter. The interface does not enforce CanExecute before a direct call. Protect domain invariants inside the implementation or application service even if a UI control is disabled.

Formal Syntax & Structure

csharp syntaxcsharp
command.Execute(parameter)

Working Example

Example Snippetcsharp
using System;using System.ComponentModel;using System.Collections.ObjectModel;using System.Windows.Input;// Partial snippet with an existing ICommand.if(command.CanExecute(null)) command.Execute(null);
C# & .NET Reference