Exemplo 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;
        }
Exemplo 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);
        }
Exemplo n.º 3
0
 protected SmartInvoker(object instance, IReflectPolicy policy)
 {
     instance.ThrowIfNullArgument(nameof(instance));
     _r = Reflector.Bind(instance, policy);
 }
Exemplo n.º 4
0
 protected SmartInvoker(object instance, IReflectPolicy policy)
 {
     instance.ThrowIfNullArgument(nameof(instance));
     _r = Reflector.Bind(instance, policy);
 }