Smrf.NodeXL.ExcelTemplate.CreateSubgraphImagesDialog.GetSelectedVertices C# (CSharp) Method

GetSelectedVertices() protected method

protected GetSelectedVertices ( IGraph oGraph, ICollection oSelectedVertexNames ) : ICollection
oGraph IGraph
oSelectedVertexNames ICollection
return ICollection
    GetSelectedVertices
    (
        IGraph oGraph,
        ICollection<String> oSelectedVertexNames
    )
    {
        Debug.Assert(oGraph != null);
        Debug.Assert(oSelectedVertexNames != null);
        AssertValid();

        List<IVertex> oSelectedVertices = new List<IVertex>();

        // Store the selected vertex names in a HashSet for quick lookup.  The
        // key is the vertex name.

        HashSet<String> oSelectedVertexNameHashSet =
            new HashSet<String>(oSelectedVertexNames);

        // Loop through the graph's vertices, looking for vertex names that are
        // in the dictionary.

        foreach (IVertex oVertex in oGraph.Vertices)
        {
            Debug.Assert( !String.IsNullOrEmpty(oVertex.Name) );

            if (oSelectedVertexNames.Contains(oVertex.Name) )
            {
                oSelectedVertices.Add(oVertex);
            }
        }

        return (oSelectedVertices);
    }