Table of Contents

Class CSTOJS

Namespace
CSharpToJavaScript
Assembly
CSharpToJavaScript.dll

Main type for CSharpToJavaScript.

public class CSTOJS
Inheritance
CSTOJS
Inherited Members

Constructors

CSTOJS()

New instance of CSTOJS with default options, see CSTOJSOptions.

public CSTOJS()

CSTOJS(CSTOJSOptions)

New instance of CSTOJS

public CSTOJS(CSTOJSOptions options)

Parameters

options CSTOJSOptions

Options of CSTOJS, see CSTOJSOptions.

Methods

GenerateOne(string)

Method for generating js StringBuilder/StringBuilders.

public List<StringBuilder> GenerateOne(string path)

Parameters

path string

Full path to cs file or to the folder with cs files.

Returns

List<StringBuilder>

List of StringBuilder

Exceptions

DirectoryNotFoundException

GenerateOneAsync(string, string?)

Method for generating js file/files.

public Task GenerateOneAsync(string path, string? filename = null)

Parameters

path string

Full path to cs file or to the folder with cs files.

filename string

Optional! Filename of a js file if you generating one file!

Returns

Task

empty Task

Exceptions

DirectoryNotFoundException

GenerateOneContinuously(string)

Method for generating continuously by watching the cs file. Writes a file.

public void GenerateOneContinuously(string path)

Parameters

path string

Full path to cs file.

Remarks

NOTE

Note: You must call StopWatching() before completing a program.

Exceptions

DirectoryNotFoundException
FileNotFoundException

GenerateOneFromString(string, List<MetadataReference>?)

Method for generating from string.

public StringBuilder GenerateOneFromString(string csstring, List<MetadataReference>? references = null)

Parameters

csstring string

CSharp string.

references List<MetadataReference>

Needed if you don't have access to files. Because Assembly.location is null in Blazor WebAssembly.

Returns

StringBuilder

JS StringBuilder

Exceptions

ArgumentNullException

GenerateOneFromStringAsync(string, string?, List<MetadataReference>?)

Method for generating from string. Writes a file.

public Task GenerateOneFromStringAsync(string csstring, string? filename = "main.js", List<MetadataReference>? references = null)

Parameters

csstring string

CSharp string.

filename string

Filename of a js file.

references List<MetadataReference>

Needed if you don't have access to files. Because Assembly.location is null in Blazor WebAssembly.

Returns

Task

empty Task

Exceptions

ArgumentNullException

StopWatching()

Method for stopping watching cs file.

public void StopWatching()