DotNetTips Blog
1,236 FOLLOWERS
David McCarter is a C# Microsoft MVP Developer/ Architect/ Consultant & Professional Code Reviewer in San Diego, California. David is the creator of dotNetTips.com that has been helping programmers since 1994. David has written for programming magazines and has published many books and his latest self-published book is David McCarter’s .NET Coding Standards.
DotNetTips Blog
2d ago
The post discusses alternative approaches to adding items to a collection using For() or ForEach() from the Task Parallel Library ..read more
DotNetTips Blog
1w ago
The use of a single character with a StringBuilder from an ObjectPool can improve performance. Benchmark results show similar overall performance, but without an ObjectPool, using a character becomes more significant. It is recommended to use a character in such cases. EditorConfig setup can check for this issue using dotnet_diagnostic.CA1834.severity = warning ..read more
DotNetTips Blog
1w ago
The article discusses best practices for checking strings for null in coding. It outlines three common methods: using == null, is null, or string.IsNullOrEmpty ..read more
DotNetTips Blog
1w ago
These articles delves into indispensable tips that should consistently be integrated into your coding practices. Though these tips may seem small, their cumulative impact becomes pronounced, particularly when handling high message volumes. Embracing these fundamental practices can yield substantial benefits for overall performance ..read more
DotNetTips Blog
1w ago
A SHA256 hash can be generated for a class, record, or structure using a specific code. Performance analysis shows that hashing a class is 1.032 times faster than a structure and 1.048 times more efficient than a record. The memory allocations for record, reference, and value types are also provided in bytes ..read more
DotNetTips Blog
1w ago
The post discusses the process of cloning different types of objects, with Microsoft recommending the use of JSON serialization for this purpose. The author explores the performance differences in cloning reference types, value types, and record types. Benchmark results using JsonSerializer reveal that cloning reference types is 1.015 times faster than cloning record types and 1.24 times more performant than cloning value types. The findings are shared for reference ..read more
DotNetTips Blog
2w ago
The content presents an alternative approach to obtaining a substring using slicing with ReadOnlySpan and AsSpan() methods, delivering performance improvement of 2.4 times based on benchmark tests. Configuration for detecting this issue in EditorConfig is also provided using dotnet_diagnostic.CA1831.severity = error ..read more
DotNetTips Blog
2w ago
I hope you will join me on Saturday, May 5th, 2024, at 10:00 PST on C# Corner TV for show #101! For the second time, my very special guest will be Milan Jovanović, Software Architect, .NET Content Creator ..read more
DotNetTips Blog
2w ago
The funny article explores the practice of Tarot card readings, emphasizing their subjective interpretation and potential for personal reflection rather than supernatural insight. Through a randomized selection by ChatGPT, the author examines the relevance of Tarot readings to their own life, highlighting skepticism tempered with curiosity about the process's validity ..read more
DotNetTips Blog
2w ago
The article compares the performance of Clear() and Fill() methods in Microsoft code analysis for Span operations. Surprisingly, Fill() outperforms Clear() by 1.06 times, despite expectations. Both methods execute without memory allocations. The article recommends configuring EditorConfig to check for this issue with dotnet_diagnostic.CA1855 set to suggestion ..read more