 <p>I guess you are asking for something like this.</p> <pre><code>public static IEnumerable&lt;T&gt; &lt;T,TCollection&gt; GetNodesRecursively(this TCollection nodeCollection, Func&lt;T, TCollection&gt; getSub) where T, TCollection: IEnumerable { foreach (var theNode in ) { yield return theNode; foreach (var subNode in GetNodesRecursively(theNode, getSub)) { yield return subNode; } } } var all_control = GetNodesRecursively(control, c=&gt;c.Controls).ToList(); </code></pre>