I am having trouble with FxCop warning CA1006, Microsoft.Design \"DoNotNestGenericTypesInMemberSignatures\". Specifically, I am designing a ReportCollection
I agree that you can ignore the CA1006 warning in the case of
Func>
Also you can simplify your code by using delegates and avoid the CA1006:
public delegate IEnumerable ChildrenDel( T parent);
// was: GetDescendants( this T item, Func< T, IEnumerable< T > > children )
public static IEnumerable< T > GetDescendants( this T item, ChildrenDel children )
{
var stack = new Stack< T >();
do {
children( item ).ForEach( stack.Push );
if( stack.Count == 0 )
break;
item = stack.Pop();
yield return item;
} while( true );
}