# Invoke Method

Calls a public method of an object or a type and returns its return value. For an instance method `TargetObject` is set, for a static method `TargetType`.


---

### :arrow_left:**INPUT**

| **Parameter** | **Type** | **Required** | **Description** |
|-----------|------|----------|-------------|
| `TargetObject` | `Object` | ❌ No     | Object whose method is called (instance method). Either `TargetObject` or `TargetType` must be set; if both are set, a validation error occurs. |


---

### :arrow_right:**OUTPUT**

| **Parameter** | **Type** | **Description** |
|-----------|------|-------------|
| `Result`  | `Object` | Return value of the method. The type of the bound variable must be compatible with the method's return type; otherwise a validation error occurs. |


---

### :arrow_down:**MISC**

| **Parameter** | **Type** | **Default** | **Description** |
|-----------|------|---------|-------------|
| `MethodName` | `String` | —       | Name of the public method to call. If left empty, a validation error occurs. |
| `TargetType` | `Type` | —       | Type whose static method is called. Either `TargetObject` or `TargetType` must be set. |
| `RunAsynchronously` | `Boolean` | `False` | If `True`, the method runs on a separate thread; if the type has `Begin<Name>` and `End<Name>` methods, those are used. In either case the activity completes when the method finishes. |


---

### Usage

* The canvas has the **TargetType**, **TargetObject** and **MethodName** fields.
* The method is looked up by its name and the types of the given parameters. If no matching public method is found or more than one method matches, a validation error occurs.