C# – Use yield return to minimize memory usage

Let’s say you want to search through a large text file for specific characters and return a list of context objects to the calling code for further processing (such as showing the results in the UI). One way to do that is to build the entire list at once and return it. If you don’t … Read more