The post critiques developers’ practices of using properties that return arrays, highlighting issues like lack of encapsulation, read-only enforcement challenges, and limited flexibility for future changes. It recommends using methods or collections as alternatives, despite performance benchmarks indicating that array properties are more efficient, ultimately suggesting adherence to Microsoft's guidelines.
Category: .NET
Collection Performance: Finding First or Last and Count
Many developers use LINQ methods such as First(), Last(), and Count() to interact with collections. However, these methods can be about 2.33× slower in performance compared to direct indexing. Caution is advised when using indexing to avoid exceptions, and consideration should be given to code readability versus performance.
Rockin’ the Code World Season 4: Special Guest Jared Parsons
On Saturday, January 20th, 2024, at 10:00 PST, don't miss show #96 on C# Corner TV featuring Jared Parsons, Principal Software Engineering Lead at Microsoft. The interview will delve into the C# compiler, .NET 8 and 9, and C# language design process. Additionally, find ways to support the Voice of Slum NGO in India and donate to the San Diego Blood Bank.
Collection Performance: Harnessing AsSpan() for Byte Array Conversion
When working with byte arrays, converting to Span can be achieved through AsSpan(). This method offers performance optimization by providing direct access without creating new arrays, efficient memory management, improved code clarity, and future-proofing for .NET framework evolution. Benchmark results show AsSpan() to be twice as performant with minimal memory allocations.
String Performance: Retrieving a Substring
The post discusses optimizing string concatenation in .NET by using the Span type, which significantly enhances performance and reduces memory allocation.
Collection Performance: Adding Items To a Dictionary
The excerpt from "Rock Your Code" discusses two methods for adding items to a Dictionary in .NET: Add() and TryAdd().
Collection Performance: The Fastest Way To Iterate Over a Collection in .NET!
Discover the quickest method to iterate over a collection in Microsoft.NET with this article, which includes performance benchmark tests.
Rockin’ the Code World Season 4: Special Guest Leslie Richardson
On Saturday, January 13th, 2024 at 10:00 PST on C# Corner TV, join David McCarter for show #94 featuring Leslie Richardson, Senior Product Manager at Microsoft. The interview will cover Visual Studio productivity/debugging, C# Dev Kit, .NET Aspire Dashboard, and Geek Humor. The episode also promotes charity and blood donation.
Rockin’ the Code World Season 4: Special Guest Brady Gaster
On Saturday, January 20th, 2024, at 10:00 PST, join C# Corner TV for show #95 featuring Brady Gaster, Principal Product Manager at Microsoft. The interview will cover Brady's work with Microsoft's Developer Division, followed by links for the show and David McCarter's content. Donations to Voice of Slum NGO and San Diego Blood Bank are encouraged.
Rock Your Code: Coding Standards for Microsoft .NET (8th Edition)
The 8th edition of the book, Rock Your Code: Coding Standards for Microsoft .NET, is available on Amazon. It consolidates Microsoft .NET coding standards and provides supplementary directives. Drawing insights from Microsoft’s code inspection tools, the book covers topics such as project setup, naming standards, class design, coding style, and more. The book's purpose is to facilitate superior code quality and swift integration of new team members. It's designed for use with Visual Studio 2022, C#, and .NET 8.

You must be logged in to post a comment.