Last active
April 25, 2021 22:21
-
-
Save aalmada/aa827395bb8512f6df6ca2037426c6ca to your computer and use it in GitHub Desktop.
Sample for the NetFabric.Hyperlinq Post.Mortem article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source) | |
where TEnumerable : IValueEnumerable<TSource, TEnumerator> | |
where TEnumerator : struct, IEnumerator<TSource> | |
{ | |
using var enumerator = source.GetEnumerator(); | |
var count = 0; | |
while (enumerator.MoveNext()) | |
count++; | |
return count; | |
} | |
public static int Count<T>(this IEnumerable<T> source) | |
{ | |
using var enumerator = source.GetEnumerator(); | |
var count = 0; | |
while(enumerator.MoveNext()) | |
count++; | |
return count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment