AjScript.ObjectUtilities.GetValue C# (CSharp) Method

GetValue() public static method

public static GetValue ( object obj, string name ) : object
obj object
name string
return object
        public static object GetValue(object obj, string name)
        {
            if (obj is IObject)
                return ((IObject)obj).GetValue(name);

            Type type = obj.GetType();

            return type.InvokeMember(name, System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.IgnoreCase | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null, obj, null);
        }

Same methods

ObjectUtilities::GetValue ( object obj, string name, object parameters ) : object

Usage Example

        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));
        }
All Usage Examples Of AjScript.ObjectUtilities::GetValue