コード例 #1
0
ファイル: ExpressionExtensions.cs プロジェクト: zb2470/moq4
        /// <summary>
        /// Checks whether the body of the lambda expression is a property indexer, which is true
        /// when the expression is an <see cref="MethodCallExpression"/> whose
        /// <see cref="MethodCallExpression.Method"/> has <see cref="MethodBase.IsSpecialName"/>
        /// equal to <see langword="true"/>.
        /// </summary>
        public static bool IsPropertyIndexer(this LambdaExpression expression)
        {
            Guard.NotNull(expression, nameof(expression));

            return(expression.Body is MethodCallExpression methodCallExpression && methodCallExpression.Method.IsSpecialName);
        }
コード例 #2
0
ファイル: ExpressionExtensions.cs プロジェクト: zb2470/moq4
        /// <summary>
        /// Checks whether the body of the lambda expression is a property access.
        /// </summary>
        public static bool IsProperty(this LambdaExpression expression)
        {
            Guard.NotNull(expression, nameof(expression));

            return(expression.Body is MemberExpression memberExpression && memberExpression.Member is PropertyInfo);
        }