AjErl.Functions.SpawnFunction.Apply C# (CSharp) Метод

Apply() публичный Метод

public Apply ( Context context, IList arguments ) : object
context Context
arguments IList
Результат object
        public object Apply(Context context, IList<object> arguments)
        {
            IFunction func = (IFunction)arguments[0];
            Process process = new Process();
            process.Start(func);
            return process;
        }

Usage Example

Пример #1
0
        public void SpawnSimpleProcess()
        {
            AutoResetEvent handle = new AutoResetEvent(false);
            int count = 0;
            IFunction func = new SpawnFunction();
            IFunction lambda = new LambdaFunction(() => { count = 1; return handle.Set(); });

            var result = func.Apply(null, new object[] { lambda });

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(Process));

            handle.WaitOne();

            Assert.AreEqual(1, count);
        }
SpawnFunction