public void CollectPathsInto(ObjectGraphPaths objectGraphPaths) { //todo consider extracting the items before passing them to this class instance var list = ToObjectsList(); var items = list.Select((o, i) => _objectGraphNodeFactory.From(_path, o, "array element[" + i + "]")); if (items.Any()) { foreach (var item in items) { item.CollectPathsInto(objectGraphPaths); } } else { objectGraphPaths.Add(new ObjectGraphPath(_path)); } }
private IEnumerable <IObjectGraphNode> FieldNodes(object o) { return(o.GetType().GetFields(BindingFlags) .Where(f => !(f.FieldType.IsValueType && f.FieldType == f.DeclaringType)) .Select(fieldInfo => _objectGraphNodeFactory.From(_path.ToList(), fieldInfo.GetValue(o), fieldInfo.Name))); }