Steven Giesel 5/26/2023

How does TryGetNonEnumeratedCount work?

Read Original

This technical article details the inner workings of the TryGetNonEnumeratedCount method introduced in .NET 6. It explains how the method attempts to retrieve the count of elements in a sequence without forcing an enumeration, covering its use with simple arrays, Enumerable.Range, and more complex LINQ queries. The post delves into the internal IIListProvider interface and how various iterators implement it to provide optimized count retrieval.

How does TryGetNonEnumeratedCount work?

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week