GetValue() публичный статический Метод

public static GetValue ( object obj, string name ) : object
obj object
name string
Результат object
Пример #1
0
        private static IDictionary ResolveToDictionary(DotExpression expression, IContext context)
        {
            object obj = ResolveToObject(expression.Expression, context);

            if (obj is DynamicObject)
            {
                DynamicObject dynobj = (DynamicObject)obj;

                obj = dynobj.GetValue(expression.Name);

                if (obj == null || obj == Undefined.Instance)
                {
                    obj = new Hashtable();
                    dynobj.SetValue(expression.Name, obj);
                }

                return((IDictionary)obj);
            }

            return((IDictionary)ObjectUtilities.GetValue(obj, expression.Name));
        }
Пример #2
0
        private static IList ResolveToList(DotExpression expression, IContext context)
        {
            object obj = ResolveToObject(expression.Expression, context);

            if (obj is DynamicObject)
            {
                DynamicObject dynobj = (DynamicObject)obj;

                obj = dynobj.GetValue(expression.Name);

                if (obj == null || obj == Undefined.Instance)
                {
                    obj = new ArrayList();
                    dynobj.SetValue(expression.Name, obj);
                }

                return((IList)obj);
            }

            return((IList)ObjectUtilities.GetValue(obj, expression.Name));
        }