Beware of These Iterator and Collection Traps
Explore common C# pitfalls when choosing between iterators and materialized collections, covering memory use, re-enumeration risks, and safer API design.
In-depth C# and .NET tutorials covering structured logging with Serilog, building Roslyn analyzers, NuGet packaging, and other core language and tooling topics.
Showing 241–246 of 264 articles
Explore common C# pitfalls when choosing between iterators and materialized collections, covering memory use, re-enumeration risks, and safer API design.
If you're writing asynchronous code in C# and using EventHandlers, odds are you've had issues with exceptions. Task EventHandlers might be consideration!
Async event handlers in C# are tricky: an async void event handler can swallow exceptions and crash your app. Use this simple safety-net pattern to handle them.
Learn how C# iterators work under the hood, including the yield keyword and IEnumerable interface, through simple code examples anyone can follow.
New to C# and looking to understand more about the IEnumerable interface? Check out this article for a crash course on getting started with C# IEnumerable!
Compare five ways to write multiline strings in C#, from escape characters and verbatim strings to raw string literals introduced with C# 11.