This discusses the principles of defensive programming to enhance software development. It emphasizes error prevention strategies such as input validation, comprehensive error handling, and assumption checking. By adopting these practices, developers can create reliable, maintainable applications, reduce bugs and their associated costs, and improve overall code quality and user satisfaction.
Category: C#
Rock Your Code: Coding Standards for Microsoft .NET (20th Anniversary Edition)
The 20th Anniversary Edition of Rock Your Code: Coding Standards for Microsoft .NET, authored by David McCarter, is now available on Amazon. This comprehensive guide offers updated standards for .NET 10, best practices, and expert insights, making it essential for software engineers aiming for improved code quality and performance over two decades.
Optimizing Array Performance in .NET: Getting the Most from ArrayPool
ArrayPool optimizes memory usage by providing a thread-safe pool of reusable arrays, significantly reducing allocations and garbage collection pressure, especially in high-performance scenarios. It's effective for I/O, serialization, and media processing. Best practices include tight scope management, clearing sensitive data on return, and careful tracking of logical array lengths.
dotNetDave Rocks ØREDEV DEVELOPERS CONFERENCE 2025
dotNetDave will speak at the Øredev Developers Conference in Malmö, Sweden, from November 5-7, 2025. His session focuses on optimizing .NET code performance, sharing techniques to improve execution speed by up to 98%. Attendees will learn about effective memory management, enhancing application efficiency while gaining practical insights from his book series.
From Extension Methods to Extension Members: Unlocking New Possibilities in .NET 10
This article examines the significance of extension methods in .NET, emphasizing their role in enhancing existing types without altering source code. It also introduces Extension Members in .NET 10 (C# 14), allowing the addition of both methods and properties, thus expanding developers' capabilities. While there are limitations, they improve code maintainability and flexibility.
Adding Extension Properties with State to Types, (Sort of) In Spargine
The author discusses the upcoming .NET 10 release and its new Extension Members feature, particularly focusing on extension properties. Despite direct support lacking, a workaround using ConditionalWeakTable enables tracking exception logging states via extension methods. The author integrates this approach into Spargine, encouraging others to try it for managing exceptions in their code.
Comparing Type Checking Methods in .NET: Performance vs. Readability
In .NET, type checking methods include GetType(), the is keyword, IsAssignableFrom(), and the as keyword. Each method varies in readability and performance.
Microsoft .NET Code Analysis: Boosting Performance with [ConstantExpected] Attribute for Methods
The [ConstantExpected] attribute in .NET enhances code performance by signaling that methods should receive compile-time constants as arguments. While not enforcing this at runtime, it improves coding practices and efficiency. In the Spargine project, it clarified intent and identified issues early, particularly with .NET 10's performance improvements across parameter types.
dotNetDave’s Faster or Not!: Optimizing Base64 Decoding in .NET
This year, the author explored faster data processing methods using Span in .NET, specifically for converting Base64 strings to byte arrays. The article aims to assist developers in making informed decisions.
dotNetDave’s Faster or Not!: Exploring Early Return in .NET Methods
The post introduces a series called "dotNetDave's Faster or Not!" which aims to explore performance claims in .NET. It discusses method return patterns, comparing early returns and single-exit methods. Despite minor performance differences favoring early returns, the author advocates for their use due to improved readability and reduced complexity in coding.

You must be logged in to post a comment.