public static MemberExpression[] GetPath <T>(Expression <Func <T> > expression) { var visitor = new PathExpressionVisitor(); visitor.Visit(expression.Body); return(Enumerable.Reverse(visitor._path).ToArray()); }
public NestedObservable(TClass source, Expression <Func <TClass, TProp> > propertyExpression) { var path = PathExpressionVisitor.GetPath(propertyExpression); foreach (var pathItem in path) { var item = new PathItem(pathItem.Expression.Type.GetProperty(pathItem.Member.Name)); _path.Add(item); } _path.First().Source = source; _path.Last().IsLast = true; AssertPathNotifies(_path); this.AddSubscriptions(0); _value = new WeakReference(_path.Last().Value, false); }