Ejemplo n.º 1
0
        public static IReflector Bind(object obj, IReflectPolicy policy)
        {
            obj.ThrowIfNullArgument(nameof(obj));

            Reflector r = new Reflector();
            if (policy.BindInstance)
            {
                r._instance = obj;
                r._type = obj.GetType();
            }
            else
            {
                r._type = obj as Type;
                if (r._type == null)
                    ThrowHelper.ThrowInvalidType("obj");
            }
            r._policy = policy;
            return r;
        }
Ejemplo n.º 2
0
        public static IReflector Bind(object obj, IReflectPolicy policy)
        {
            obj.ThrowIfNullArgument(nameof(obj));

            Reflector r = new Reflector();

            if (policy.BindInstance)
            {
                r._instance = obj;
                r._type     = obj.GetType();
            }
            else
            {
                r._type = obj as Type;
                if (r._type == null)
                {
                    ThrowHelper.ThrowInvalidType("obj");
                }
            }
            r._policy = policy;
            return(r);
        }
Ejemplo n.º 3
0
 protected SmartInvoker(object instance, IReflectPolicy policy)
 {
     instance.ThrowIfNullArgument(nameof(instance));
     _r = Reflector.Bind(instance, policy);
 }
Ejemplo n.º 4
0
 protected SmartInvoker(object instance, IReflectPolicy policy)
 {
     instance.ThrowIfNullArgument(nameof(instance));
     _r = Reflector.Bind(instance, policy);
 }