Data types

SSharp S# API

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

It is possible to expose any .NET data type or instance to S#. There are however common .NET types available for script by default:

Type Name

.NET Analogue

Initializer

double

double

x = 1.23; x = 12d;

long

long

x = 3;

string

string

s='Hello World!'

bool

bool

b = true

array

object[]

A = [1, 1+2, 'Hello', s]

There is also an implicit type object which is basically alias for .NET System.Object. The list of base types may be changed through xml configuration. However, it does not mean that run-time can't access other .NET types. In contrast, base types are cached by alias and may be accessed faster that other types. Consider this if you want to improve performance of script execution.

Note: S# runtime infrastructure allows to filter types and whole assemblies available to the client scripts. It is also possible to mark members of a class definition with [Promote(false)] attribute to make them invisible to the default script binder.

Any type visible to the runtime can be accessed either by short name:

 b = new StringBuilder();

or by its full name:

 b = new System.Text.StringBuilder();

Besides the XML configuration, it is also possible to expose any .NET Framework type to the S# programs and use it within a script via the RuntimeHost.AddType() method.

Note: If a type was not explicitly added, the S# runtime will search it in libraries loaded in the current application domain. Although it is possible to filter assemblies and types available to the script as well as completely override the assembly/type management through a custom implementation of the IAssemblyManager interface.