# ICommand

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Defines a command that can be used for data binding.

{% tabs %}
{% tab title="C#" %}

```csharp
public interface ICommand
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Interface ICommand
```

{% endtab %}
{% endtabs %}

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CanExecute(args)

Defines a method that determines whether the command can execute in its current state.

| Parameter | Type                                                                                   | Description                                                                                                                                  |
| --------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [CommandArgs](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.commandargs) | A [CommandArgs](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.commandargs) that contains data that can be used by the command. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if this command can be executed; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Execute(args)

Defines a method to be called when the command is invoked.

| Parameter | Type                                                                                   | Description                                                                                                                                  |
| --------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [CommandArgs](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.commandargs) | A [CommandArgs](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.commandargs) that contains data that can be used by the command. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) RaiseCanExecuteChanged()

Fires the [CanExecuteChanged](#canexecutechanged) event.

## Events

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CanExecuteChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when changes occur that affect whether or not the command should execute.

## Implemented By

| Name                                                                                                        | Description                                                                                                                                      |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Command](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.command)                              | Implements the [ICommand](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.icommand) interface wrapping execute and canExecute actions. |
| [Command\<T>](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.command-less-than-t-greater-than) | Implements the [ICommand](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.icommand) interface wrapping execute and canExecute actions. |
