public bool Contains(T possibleChild) { IDirectedGraphNode <T> tn = possibleChild as IDirectedGraphNode <T>; if (tn == null) { tn = new DirectedGraphNode <T>(possibleChild); } return(ContainsNode(tn)); }
/// <summary> /// Adds the specified new member to this collection. /// </summary> /// <param name="newMember">The new member.</param> /// <returns>The DirectedGraphNode that resulted from this addition - either the node to be added, or its DirectedGraphNode wrapper.</returns> public IDirectedGraphNode <T> Add(T newMember) { // If necessary, create a DirectedGraphNode wrapper. IDirectedGraphNode <T> tn = newMember as IDirectedGraphNode <T>; if (tn == null) { tn = new DirectedGraphNode <T>(newMember); } return(AddNode(tn)); }