System.Linq.Dynamic.ExpressionParser.GenerateMemberAccess C# (CSharp) Method

GenerateMemberAccess() private static method

private static GenerateMemberAccess ( Type type, Expression instance, int errorPos, string name ) : Maybe
type Type
instance Expression
errorPos int
name string
return Maybe
		private static Maybe<Expression> GenerateMemberAccess(Type type, Expression instance, int errorPos, string name)
		{
			MemberInfo member = FindPropertyOrField(type, name, instance == null);
			if (member != null)
			{
				return member is PropertyInfo
					? Expression.Property(instance, (PropertyInfo) member)
					: Expression.Field(instance, (FieldInfo) member);
			}

			Expression expression;
			if (DynamicDictionary.TryGetExpression(type, instance, errorPos, name, out expression))
			{
				return expression;
			}

			return Maybe.Nothing;
		}
ExpressionParser