Esempio n. 1
0
        public static void Scenario_RemoteEvaluation()
        {
            ScriptRuntime runtime = ScriptRuntime.CreateRemote(
                AppDomain.CreateDomain("remote domain"),
                ScriptRuntimeSetup.ReadConfiguration()
                );

            ScriptEngine     engine = runtime.GetEngine("python");
            ObjectOperations ops    = engine.Operations;

            ObjectHandle classC = engine.ExecuteAndWrap(@"
class C(object):
  def __init__(self, value):
    self.value = value
    
  def __int__(self):
    return self.value

C
");

            ObjectHandle result    = ops.CreateInstance(classC, 17);
            int          intResult = ops.Unwrap <int>(result);

            Console.WriteLine(intResult);
        }