Rock Your Code: Code & App Performance for Microsoft .NET (4th Edition)

"Rock Your Code: Code & App Performance for Microsoft .NET" is a comprehensive guide that emphasizes the importance of optimizing code performance for enhanced user experience and backend efficiency. With practical insights and example code, developers learn essential practices for maximizing the performance of their business applications within the Microsoft .NET framework. From string manipulation to leveraging source generators, this edition covers a wide range of topics, including new chapters on code analysis and benchmark testing. Written for developers using Microsoft .NET 8 and Visual Studio 2022, this book offers timeless principles applicable across different versions of .NET, ensuring relevance and utility in any environment.

Optimizing Data Manipulation with LINQ

The content explores using LINQ in .NET to query and manipulate data from various sources. It highlights benefits like integration into C# and VB.NET, type safety, composition of operations, and support for diverse data sources. Benchmark results reveal performance differences, emphasizing the need for careful approach selection.

Collection Performance

These articles delves into performance optimization for collections in .NET, covering topics like looping, sorting, and utilizing different types of objects. The author identified performance variations related to the object type in the collection and recommends conducting benchmark tests. All recommendations are specific to .NET 8.

Mastering Globalization

Internationalization and localization are crucial for software projects, involving adapting to various languages, regions, and technical requirements. Delaying consideration until later stages can lead to significant costs and effort. The importance of addressing globalization from the outset is emphasized, along with a recommendation to explore the book "Rock Your Code: Coding Standards for Microsoft .NET" for comprehensive insights.

Optimizing String Performance

These articles delve into the intricacies of string handling in programming, emphasizing the fundamental role strings play in representing text. It explores various aspects such as checking for empty strings efficiently, verifying if an object is a string, string comparison methods, formatting strings, checking for substrings and characters, retrieving and slicing substrings, concatenating strings, optimizing concatenation with StringBuilder and ObjectPool, appending single characters, encoding and decoding strings, and string compression using Brotli, Deflate, GZip, and ZLib formats. Benchmark results are provided throughout, offering insights into performance considerations. Additionally, the chapter highlights recommendations and best practices for string manipulation while referencing my open-source project, Spargine, for streamlined string handling processes.

Collection Performance: Is LINQ Always the Most Performant Choice?

The article explores the performance implications of using LINQ for collection queries, finding that a conventional foreach() loop outperforms LINQ by 1.75 times in identifying items matching a given query. The conclusion suggests benchmarking to determine the optimal approach based on the nature of the query and elements being sought.