Beispiel #1
0
        /// <summary>
        /// 快速给属性赋值
        /// </summary>
        /// <param name="property"></param>
        /// <param name="instance"></param>
        /// <param name="value"></param>
        public static void FastSetValue(this PropertyInfo property, object instance, object value)
        {
            var setter = DynamicCalls.GetPropertySetter(property);

            setter(instance, value);
        }
Beispiel #2
0
        /// <summary>
        /// 快速获取属性值
        /// </summary>
        /// <param name="property"></param>
        /// <param name="instance"></param>
        /// <returns></returns>
        public static object FastGetValue(this PropertyInfo property, object instance)
        {
            var getter = DynamicCalls.GetPropertyGetter(property);

            return(getter(instance));
        }