Updated Scripting API Samples (markdown)

Tomáš Matoušek 2016-12-19 14:33:17 +01:00
Родитель b2303857e0
Коммит d6db19000c
1 изменённых файлов: 2 добавлений и 2 удалений

@ -98,13 +98,13 @@ var script = CSharpScript.Create<int>("X*Y", globalsType: typeof(Globals));
ScriptRunner<int> runner = script.CreateDelegate();
for (int i = 0; i < 10; i++)
{
await runner(new Globals { X = i, Y = i });
Console.WriteLine(await runner(new Globals { X = i, Y = i }));
}
```
#### <a name="inspect"></a> Run a C# snippet and inspect defined script variables
```csharp
var state = await CSharpScript.RunAsync<int>("int answer = 42");
var state = await CSharpScript.RunAsync<int>("int answer = 42;");
foreach (var variable in state.Variables)
Console.WriteLine($"{variable.Name} = {variable.Value} of type {variable.Type}");
```