Skip to content

Latest commit

 

History

History
55 lines (34 loc) · 3.81 KB

File metadata and controls

55 lines (34 loc) · 3.81 KB

Overview of C# Scripting

C# Scripting is a powerful and flexible scripting feature provided by Microsoft Roslyn. It designed to make scripts you cut and pasted from C# code work as-is. So, you can build your own gesture environment easily just only with a little of knowledge of C# language. But C# Scripting has only a few special feature C# language does not have. The following sections are the introduction of the features very useful if you know it when you need to do it.

#r directive

You can add reference to assemblies by #r directive.

// Add a reference to dll file.
#r "path_to/Assembly.dll"

// Add a reference to an assembly.
#r "System.Speech"

// Error occurrs unless you have installed Visual Studio.
#r "Microsoft.VisualStudio" 

Note 1: This directive should be placed on the top of your C# Scripting code. Note 2: This directive does not support to load NuGet package automatically. You can do it by download NuGet package by yourself, extract dll files, and add refereces to it by using #r directive.

#load directive

You can load the content in another C# Scripting file by #load directive.

#load "path_to/another.csx"

Note : This directive should be placed on the top of your C# Scripting code except for #r directive.

Tutorial of C# Language

There are a lot of good tutorials of C# language that you can pick to learn. The followings are just an example:

https://docs.microsoft.com/en-us/dotnet/csharp/quick-starts/

http://www.learncs.org/

https://www.sololearn.com/Course/CSharp/

https://www.tutorialspoint.com/csharp/index.htm

https://mva.microsoft.com/en-US/training-courses/c-fundamentals-for-absolute-beginners-16169?l=Lvld4EQIC_2706218949

https://docs.microsoft.com/en-us/dotnet/csharp/