The article discusses the introduction of a simplified new expression syntax in .NET 5, which allows for more concise and readable object initialization. The new syntax offers advantages such as reduced boilerplate code, improved readability, support for immutable types, and enhanced IDE integration.
Category: .NET Coding Standards
Real World Coding Issues: Part 3 – Design, Diagnostics, and Other Common Code Issues
The article discusses real-world coding issues encountered in a contract project. Part 3 covers common coding issues related to design, diagnostics, and other areas, such as globalization, code duplication, and Linux-based development challenges. It emphasizes the importance of code quality, performance, and prioritizing code reviews to ensure a maintainable and efficient solution.
Microsoft .NET Code Analysis: Use Auto-Implemented Property
The article discusses the use of auto-implemented properties in Microsoft .NET code analysis. While the author generally advises against their excessive use, they highlight a real-world example where utilizing an auto-implemented property is advantageous due to its conciseness, readability, encapsulation, and ease of maintenance. The author recommends using tools like CodeRush from DevExpress to streamline the refactoring process.
Microsoft .NET Code Analysis: Validate Arguments of Public Methods
The author highlights the critical issue of insufficient argument validation in public methods, drawing on 20 years of experience. They emphasize its importance for maintaining encapsulation in object-oriented programming. A significant finding revealed 700 instances of this oversight, showcasing the necessity for proper validation to ensure data integrity. Recommended resources are mentioned for further learning.
Microsoft .NET Code Analysis: Do Not Expose Generic Lists
Approximately 90% of code reviews highlight the use of List in public APIs, a practice discouraged by Microsoft due to issues with encapsulation and flexibility. Alternatives like ReadOnlyCollection are recommended for better abstraction and performance. Proper usage can enhance compatibility and maintainability in codebases.
Microsoft .NET Code Analysis: Ensuring Proper Resource Management – Implementing IDisposable for Disposable Objects
One persistent issue I have noticed throughout my experience working on projects for the past 12 years is the improper handling of disposable objects and the lack of implementation of IDisposable for types with disposable fields. Failing to handle these objects correctly can lead to virtual memory leaks and subsequently bring down applications and services. Unfortunately, this problem occurs far too frequently.
Real World Coding Issues: Part 2 – Style and Performance Issues
The author is nearing the end of a contract and wants to discuss coding issues they encountered during the development of a particular solution and other projects. Their goal is to provide valuable insights to improve the codebase of the current project. They reflect on the initial state of the codebase when they joined the team and how it has evolved during their tenure. The author's objective is to leave the code, project, and team in a better state than when they started. They were hired to enhance performance and code quality. The author also mentions that they have noticed common coding issues in multiple projects and this article aims to provide statistics and highlight these prevalent issues.
Microsoft .NET Code Analysis: Recognizing the Significance of ConfigureAwait in Reusable Assemblies
Check out this article on the importance of ConfigureAwait() in reusable assemblies. It discusses performance, avoiding deadlocks, and scalability.
Microsoft .NET Code Analysis: UTF-7 Encoding Is Insecure
In the codebase I reviewed for this article, I found several instances where UTF-7 encoding was used, which is no longer recommended and is prohibited by many specifications. It is important to avoid using UTF-7 encoding that is explained in this article.
Microsoft .NET Code Analysis: Always Add Braces {} in C#
The discussion centers around the usage of braces in C# statements and their criticality in maintaining code readability and structure. Using braces helps delineate code blocks, groups statements, controls flow and scope and avoids unintended errors. The author promotes regular refactoring with tools like CodeRush and suggests integrating specific settings into the EditorConfig file. He also recommends his books for additional guidance and insights.

You must be logged in to post a comment.