コード例 #1
0
        public static IList <TestPackage> Select(this TestPackage package, TestPackageSelectorDelegate selector)
        {
            var selection = new List <TestPackage>();

            AccumulatePackages(package, selection, selector);

            return(selection);
        }
コード例 #2
0
        private static void AccumulatePackages(TestPackage package, IList <TestPackage> selection, TestPackageSelectorDelegate selector)
        {
            if (selector(package))
            {
                selection.Add(package);
            }

            foreach (var subPackage in package.SubPackages)
            {
                AccumulatePackages(subPackage, selection, selector);
            }
        }