Table of Contents

Property ScriptHost

Namespace
Alternet.Scripter
Assembly
Alternet.Scripter.v9.dll

ScriptHost

Returns object that implements IScriptHost interface for this runner.

[Browsable(false)]
public virtual IScriptHost ScriptHost { get; set; }

Property Value

IScriptHost

Examples

Here is how to use a ScriptHost in the C# code:

using System;

using Alternet.Scripter;

public partial class Form1 : Form
{
    private ScriptRun scriptRun;
    private void Form1_Load(object sender, EventArgs e)
    {
        scriptRun = new ScriptRun();
        scriptRun.ScriptLanguage = ScriptLanguage.CSharp;
        scriptRun.ScriptHost.GenerateModulesOnDisk = true;
        scriptRun.ScriptHost.ModulesDirectoryPath = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), "Alternet Script Debugger Generated Modules");
        scriptRun.ScriptHost.AssemblyFileName = Guid.NewGuid().ToString("N") + ".dll";
    }
}

Here is how to use a ScriptHost in the Visual Basic code:

Imports System
Imports Alternet.Scripter

Partial Public Class Form1
    Inherits Form

    Private scriptRun As ScriptRun

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        scriptRun = New ScriptRun()
        scriptRun.ScriptLanguage = ScriptLanguage.CSharp
        scriptRun.ScriptHost.GenerateModulesOnDisk = True
        scriptRun.ScriptHost.ModulesDirectoryPath = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), "Alternet Script Debugger Generated Modules")
        scriptRun.ScriptHost.AssemblyFileName = Guid.NewGuid().ToString("N") & ".dll"
    End Sub
End Class

Remarks

ScriptHost contains properties and methods related to the C# or Visual Basic scripts compilation and execution.

Most of the time you don�t need to use ScriptHost directly, as most of its properties and methods are accessible via ScriptRun.