mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:48:46 +00:00
perf: exit early if TryGetNonEnumeratedCount is 0
This commit is contained in:
parent
f30c052673
commit
f360311d9c
@ -65,6 +65,13 @@ public static class EnumerableExtensions
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
if (source.TryGetNonEnumeratedCount(out int count) && count == 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
#endif
|
||||
|
||||
var regex = new Regex(pattern, RegexOptions.Compiled | (ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None));
|
||||
|
||||
foreach (string item in source)
|
||||
|
Loading…
Reference in New Issue
Block a user