# ClearScript

Namespace: **Wisej.Ext.ClearScript**

Assembly: **Wisej.Ext.ClearScript** (3.2.0.0)

Creates and manages instances of the ClearScript scripting engines. The documentation on how to use the scripting engine is available here: [R\_Project\_Reference](https://microsoft.github.io/ClearScript/Reference/html/R_Project_Reference.htm).

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

```csharp
public class ClearScript
```

{% endtab %}

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

```visual-basic
Public Class ClearScript
```

{% endtab %}
{% endtabs %}

ClearScript Windows engines (VBScript and JScript) are thread-bound. Once the engine has been created it must always run within the thread that created it. When [Create](#create-type-name-v8constraints-v8flags-windowsflags) is called passing [VBScript](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) or [JScript](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields), it creates the new scripting engine on a new dedicated thread and marshals all calls to the thread the engine is bound to. When [Create](#create-type-name-v8constraints-v8flags-windowsflags) is called passing [V8](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) if creates the new scripting engine without a dedicated thread since the VB engine can process requests from any thread.

{% hint style="info" %}
When using [VBScript](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) or [JScript](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) DO NOT FORGET TO DISPOSE the instance when you are done with the scripting engine to release the dedicated thread. If you don't dispose and don't keep a reference, the thread will be automatically terminated when the garbage collector kicks in.
{% endhint %}

## Methods

### ![](https://2248866391-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFp7MR1wemvcC5891_r%2F-MirBc8UH2o1iZfh0jrC%2F-MirBsnox1cbEBcVJYTK%2Fstatic.png?alt=media\&token=9c92a67d-a608-4268-bb67-eaee38f9c0e2)Create(type, name, v8constraints, v8flags, windowsflags)

Creates a new instance of the specified *type* .

| Parameter         | Type                                                                                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **type**          | [EngineType](https://docs.wisej.com/extensions/extensions/clearscript/api/wisej.ext.clearscript.enginetype)                    | The [EngineType](https://docs.wisej.com/extensions/extensions/clearscript/api/wisej.ext.clearscript.enginetype) to create.                                                                                                                                                                                                                                                                                                  |
| **name**          | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)                                                            | A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.                                                                                                                                                                                                                                                                               |
| **v8constraints** | [V8RuntimeConstraints](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.v8.v8runtimeconstraints)              | An optional instance of [V8RuntimeConstraints](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.v8.v8runtimeconstraints) used to initialize the [V8](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) script engine.                                                                                                                                      |
| **v8flags**       | [V8ScriptEngineFlags](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.v8.v8scriptengineflags)                | An optional combination of [V8ScriptEngineFlags](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.v8.v8scriptengineflags) flags used to initialize the [V8](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) script engine.                                                                                                                               |
| **windowsflags**  | [WindowsScriptEngineFlags](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.windows.windowsscriptengineflags) | An optional combination of [WindowsScriptEngineFlags](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.windows.windowsscriptengineflags) flags used to initialize the [JScript](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) or [VBScript](https://docs.wisej.com/extensions/extensions/clearscript/wisej.ext.clearscript.enginetype#fields) engines. |

**Returns:** [ScriptEngine](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.scriptengine). The requested [ScriptEngine](https://docs.microsoft.com/en-us/dotnet/api/microsoft.clearscript.scriptengine) implementation.
