AjTalk.Language.FunctionalMethod.Execute C# (CSharp) Метод

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

public Execute ( System.Machine machine, IObject self, IObject receiver, object args ) : object
machine System.Machine
self IObject
receiver IObject
args object
Результат object
        public object Execute(Machine machine, IObject self, IObject receiver, object[] args)
        {
            // TODO review, used in Machine to define ifNil:
            if (this.function == null)
                return this.nativeFunction(machine, self, args);

            return this.function(machine, self, receiver, args);
        }

Same methods

FunctionalMethod::Execute ( System.Machine machine, IObject self, object args ) : object
FunctionalMethod::Execute ( System.Machine machine, object args ) : object

Usage Example

Пример #1
0
        public void CreateAndExecuteFunctionalMethod()
        {
            int count = 0;
            FunctionalMethod method = new FunctionalMethod((Machine machine, IObject x, IObject y, object[] args) => ++count);

            Assert.IsNull(method.Name);
            Assert.IsNull(method.Behavior);

            object result = method.Execute(null, null, null);

            Assert.AreEqual(1, count);
            Assert.AreEqual(1, result);
        }