AjScript.Language.DynamicObject.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( string name ) : object
name string
return object
        public virtual object GetValue(string name)
        {
            if (this.values.ContainsKey(name))
                return this.values[name];

            if (this.noenumvalues.ContainsKey(name))
                return this.noenumvalues[name];

            if (this.function == null)
                return Undefined.Instance;

            object prototype = this.function.GetValue("prototype");

            if (prototype == null || prototype == Undefined.Instance)
                return Undefined.Instance;

            return ((IObject)prototype).GetValue(name);
        }

Usage Example

Example #1
0
        public void DefineMethod()
        {
            DynamicObject dynobj = new DynamicObject();

            ICommand body = new ReturnCommand(new VariableExpression("Name"));
            Function function = new Function(null, body);

            dynobj.SetValue("GetName", function);

            object result = dynobj.GetValue("GetName");

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ICallable));
            Assert.IsTrue(result == function);
        }
All Usage Examples Of AjScript.Language.DynamicObject::GetValue