public static ConditionalMemberCSharpExpression ConditionalProperty(Expression expression, PropertyInfo property) { RequiresCanRead(expression, nameof(expression)); ContractUtils.RequiresNotNull(property, nameof(property)); if (!property.CanRead) { throw Error.ConditionalAccessRequiresReadableProperty(); } if (property.GetIndexParameters().Length != 0) { throw Error.ConditionalAccessRequiresReadableProperty(); } if (property.GetGetMethod(true).IsStatic) { throw Error.ConditionalAccessRequiresNonStaticMember(); } var type = expression.Type.GetNonNullReceiverType(); if (!TypeUtils.IsValidInstanceType(property, type)) { throw LinqError.PropertyNotDefinedForType(property, type); } return(ConditionalMemberCSharpExpression.Make(expression, property)); }