# 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

### ![](/files/hsR4ok3152WyAf8J2C1u) CanExecute(args)

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

| Parameter | Type                                                                | Description                                                                                                               |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [CommandArgs](/api/wisej.web/data-binding/wisej.web.commandargs.md) | A [CommandArgs](/api/wisej.web/data-binding/wisej.web.commandargs.md) 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.

### ![](/files/hsR4ok3152WyAf8J2C1u) Execute(args)

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

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

### ![](/files/hsR4ok3152WyAf8J2C1u) RaiseCanExecuteChanged()

Fires the [CanExecuteChanged](#canexecutechanged) event.

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) 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](/api/wisej.web/data-binding/wisej.web.command.md)                              | Implements the [ICommand](/api/wisej.web/interfaces/wisej.web.icommand.md) interface wrapping execute and canExecute actions. |
| [Command\<T>](/api/wisej.web/data-binding/wisej.web.command-less-than-t-greater-than.md) | Implements the [ICommand](/api/wisej.web/interfaces/wisej.web.icommand.md) interface wrapping execute and canExecute actions. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.icommand.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
