/// <summary> /// If the given item already has dependency information in the graph it's returned, else /// a dependency information object for the item is created in the graph and returned /// </summary> /// <param name="item"></param> /// <returns></returns> public DependencyInfo <TItem> ItemToDependency(TItem item) { DependencyInfo <TItem> dep; var key = ItemToKey(item); if (_dependencies.TryGetValue(key, out dep) == false) { dep = new DependencyInfo <TItem>(item); _dependencies.Add(key, dep); } return(dep); }
/// <summary> /// Try get the dependency information of the given item if exists in the graph /// </summary> /// <param name="key"></param> /// <param name="dep"></param> /// <returns></returns> public bool TryGetDependencyOfItem(TKey key, out DependencyInfo <TItem> dep) { return(_dependencies.TryGetValue(key, out dep)); }