/// <summary> /// Helper method determines if the region has enough parquets satisfying the given predicate /// to meet or exceed the given threshold. /// </summary> /// <param name="in_region">The region to test.</param> /// <param name="in_predicate">A predicate indicating if the parquet should be counted.</param> /// <param name="in_threshold">A total number of parquets that must be met for the region to qualify.</param> /// <returns><c>true</c>, if enough parquets satisfy the conditions given, <c>false</c> otherwise.</returns> private static bool CountMeetsOrExceedsThreshold(MapRegion in_region, Predicate <ParquetParent> in_predicate, int in_threshold) { var count = 0; foreach (var parquet in in_region.GetAllParquets()) { if (in_predicate(parquet)) { count++; } } return(count >= in_threshold); }