public bool Equals(MethodValueGetter other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Equals(other._methodInfo, _methodInfo) && other._arguments.SequenceEqual(_arguments)); }
private static void buildValueGetters(Expression expression, IList <IValueGetter> list) { var memberExpression = expression as MemberExpression; if (memberExpression != null) { var propertyInfo = (PropertyInfo)memberExpression.Member; list.Add(new PropertyValueGetter(propertyInfo)); if (memberExpression.Expression != null) { buildValueGetters(memberExpression.Expression, list); } } //deals with collection indexers, an indexer [0] will look like a get(0) method call expression var methodCallExpression = expression as MethodCallExpression; if (methodCallExpression != null) { MethodInfo methodInfo = methodCallExpression.Method; Expression argument = methodCallExpression.Arguments.FirstOrDefault(); if (argument == null) { var methodValueGetter = new MethodValueGetter(methodInfo, new object[0]); list.Add(methodValueGetter); } else { object value; if (TryEvaluateExpression(argument, out value)) { var methodValueGetter = new MethodValueGetter(methodInfo, new[] { value }); list.Add(methodValueGetter); } } if (methodCallExpression.Object != null) { buildValueGetters(methodCallExpression.Object, list); } } }
public bool Equals(MethodValueGetter other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other._methodInfo, _methodInfo) && other._arguments.SequenceEqual(_arguments); }
public SingleMethod(MethodValueGetter getter, Type ownerType) { _getter = getter; _ownerType = ownerType; }
public SingleMethod(MethodValueGetter getter) { _getter = getter; }