Beispiel #1
0
        /// <summary>
        /// 判断该MemberExpression表达式是否为访问目标类型的表达式
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        private bool IsTargetTypeMember(Expression expression)
        {
            var exp = expression as MemberExpression;

            if (exp == null)
            {
                return(false);
            }
            var declaringType = exp.Member.DeclaringType;

            return(declaringType == TargetType || TargetType.IsSubclassOf(declaringType));
        }