Esempio n. 1
0
        public void TestToStaticAction()
        {
            var foo = GetType().GetMethod("Foo");
            var act = MethodInfoUtil.ToStaticAction <int>(foo);

            act(10);
        }
Esempio n. 2
0
        public void Invoke(object target, MethodInfo method, object arg)
        {
            IActionInvoker invoker;

            if (!_methodToActionInvoker.TryGetValue(method, out invoker))
            {
                invoker = MethodInfoUtil.ToActionInvoker(method);
                _methodToActionInvoker[method] = invoker;
            }
            invoker.Invoke(target, arg);
        }
Esempio n. 3
0
        // ========================================
        // method
        // ========================================
        public PropertyInfo GetPropertyInfo(MethodInfo method)
        {
            PropertyInfo ret;

            if (!_MethodToPropMap.TryGetValue(method, out ret))
            {
                if (MethodInfoUtil.IsPropertyGetter(method))
                {
                    ret = MethodInfoUtil.GetPropertyForGetter(method);
                    _MethodToPropMap.Add(method, ret);
                }
                else if (MethodInfoUtil.IsPropertySetter(method))
                {
                    ret = MethodInfoUtil.GetPropertyForSetter(method);
                    _MethodToPropMap.Add(method, ret);
                }
                else
                {
                    _MethodToPropMap.Add(method, null);
                }
            }

            return(ret);
        }