System.Linq.Expressions.Error.MemberNotFieldOrProperty C# (CSharp) Метод

MemberNotFieldOrProperty() статический приватный Метод

ArgumentException with message like "Member '{0}' not field or property"
static private MemberNotFieldOrProperty ( object p0, string paramName ) : Exception
p0 object
paramName string
Результат System.Exception
        internal static Exception MemberNotFieldOrProperty(object p0, string paramName)
        {
            return new ArgumentException(Strings.MemberNotFieldOrProperty(p0), paramName);
        }
        /// <summary>

Usage Example

Пример #1
0
        /// <summary>
        /// Creates a <see cref="ConditionalMemberCSharpExpression" /> that represents a conditional (null-propagating) member lookup.
        /// </summary>
        /// <param name="expression">An <see cref="Expression" /> that specifies the instance to access the member of.</param>
        /// <param name="member">The <see cref="MemberInfo" /> representing the member to access conditionally.</param>
        /// <returns>A <see cref="ConditionalMemberCSharpExpression" /> that has the <see cref="CSharpNodeType" /> property equal to <see cref="CSharpExpressionType.ConditionalAccess" /> and the <see cref="ConditionalAccessCSharpExpression{MemberExpression}.Receiver" /> and <see cref="Microsoft.CSharp.Expressions.ConditionalMemberCSharpExpression.Member" /> properties set to the specified values.</returns>
        public static ConditionalMemberCSharpExpression MakeConditionalMemberAccess(Expression expression, MemberInfo member)
        {
            RequiresNotNull(member, nameof(member));

            return(member switch
            {
                FieldInfo fieldInfo => ConditionalField(expression, fieldInfo),
                PropertyInfo propertyInfo => ConditionalProperty(expression, propertyInfo),

                // NB: LINQ doesn't allow a MethodInfo for a property getter here either; should we change this?
                _ => throw LinqError.MemberNotFieldOrProperty(member)
            });
All Usage Examples Of System.Linq.Expressions.Error::MemberNotFieldOrProperty
Error