How to get all checked items but to exclude main nodes with subitems?

For example take a look in this picture: 

[![enter image description here](https://i.stack.imgur.com/dVF5h.png)](https://i.stack.imgur.com/dVF5h.png)

I want to get all checked items but to exclude marekd with yellow but still to have their subitems listed.

So far i did this:

```
List<String> CheckedNames(System.Windows.Forms.TreeNodeCollection theNodes)
    {
        List<String> aResult = new List<String>();

        if (theNodes != null)
        {
            foreach (System.Windows.Forms.TreeNode aNode in theNodes)
            {
                if (aNode.Checked)
                {
                    string[] itemName = Regex.Split(aNode.Text, " - ");
                    aResult.Add(itemName[0]);
                }

                aResult.AddRange(CheckedNames(aNode.Nodes));
            }
        }

        return aResult;
    }

```