06-20-2019, 04:44 AM
CsScript x
x.SetOptions("references=C:\Chilkat\ChilkatDotNet47.dll")
x.AddCode("")
;call static function
str R=x.Call("Class1.TestFunction")
out R
#ret
//C# code
using System;
using Chilkat;
public class Class1
{
public static string TestFunction()
{
Chilkat.JsonObject json = new Chilkat.JsonObject();
bool success;
// The only reason for failure in the following lines of code would be an out-of-memory condition..
// An index value of -1 is used to append at the end.
// int index = -1;
success = json.AddStringAt(-1,"Title","Pan's Labyrinth");
success = json.AddStringAt(-1,"Director","Guillermo del Toro");
success = json.AddStringAt(-1,"Original_Title","El laberinto del fauno");
success = json.AddIntAt(-1,"Year_Released",2006);
json.EmitCompact = false;
//Console.WriteLine(json.Emit());
return json.Emit();
}
}