Developers often use string.Substring() to extract a string portion. However, using string.AsSpan() instead can enhance performance significantly. Benchmarks show that AsSpan() is 44.6 times faster than Substring(), with zero allocations. To enforce AsSpan() usage, configure EditorConfig with dotnet_diagnostic.CA1836.severity = warning.
String Performance Microsoft .NET: Retrieving a Substring
Older messages
Collection Performance in Microsoft .NET: Adding Items To a Dictionary
Friday, January 19, 2024
dotNetDave posted: " When incorporating items into a Dictionary, the prevalent approach in the code I review involves using the Add() method, as illustrated below: var collection = new Dictionary
Collection Performance: The Fastest Way To Iterate Over a Collection in .NET!
Wednesday, January 17, 2024
dotNetDave posted: " Subscriber Content Starting with .NET 5, a new method for iterating over collections was introduced: CollectionsMarshal.AsSpan<T>. The CollectionsMarshal.AsSpan method
Rockin’ the Code World Season 4: Special Guest Leslie Richardson
Thursday, January 4, 2024
dotNetDave posted: " I hope you will join me on Saturday, January 13th, 2024, at 10:00 PST on C# Corner TV for show #94! My very special guest will be Leslie Richardson, Senior Product Manager at
Rockin’ the Code World Season 4: Special Guest Brady Gaster
Wednesday, January 3, 2024
dotNetDave posted: " I hope you will join me on Saturday, January 20th, 2024, at 10:00 PST on C# Corner TV for show #95! My very special guest will be Brady Gaster, Principal Product Manager at
Modernizing Microsoft Office: A Call for Innovation in Word
Tuesday, January 2, 2024
dotNetDave posted: " In December 2023, I finalized the 8th edition of my book, "Rock Your Code: Coding Standards for Microsoft .NET," spanning an impressive 560 pages. Regrettably, the
You Might Also Like
Daily Coding Problem: Problem #1707 [Medium]
Monday, March 3, 2025
Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Facebook. In chess, the Elo rating system is used to calculate player strengths based on
Simplification Takes Courage & Perplexity introduces Comet
Monday, March 3, 2025
Elicit raises $22M Series A, Perplexity is working on an AI-powered browser, developing taste, and more in this week's issue of Creativerly. Creativerly Simplification Takes Courage &
Mapped | Which Countries Are Perceived as the Most Corrupt? 🌎
Monday, March 3, 2025
In this map, we visualize the Corruption Perceptions Index Score for countries around the world. View Online | Subscribe | Download Our App Presented by: Stay current on the latest money news that
The new tablet to beat
Monday, March 3, 2025
5 top MWC products; iPhone 16e hands-on📱; Solar-powered laptop -- ZDNET ZDNET Tech Today - US March 3, 2025 TCL Nxtpaper 11 tablet at CES The tablet that replaced my Kindle and iPad is finally getting
Import AI 402: Why NVIDIA beats AMD: vending machines vs superintelligence; harder BIG-Bench
Monday, March 3, 2025
What will machines name their first discoveries? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
GCP Newsletter #440
Monday, March 3, 2025
Welcome to issue #440 March 3rd, 2025 News LLM Official Blog Vertex AI Evaluate gen AI models with Vertex AI evaluation service and LLM comparator - Vertex AI evaluation service and LLM Comparator are
Apple Should Swap Out Siri with ChatGPT
Monday, March 3, 2025
Not forever, but for now. Until a new, better Siri is actually ready to roll — which may be *years* away... Apple Should Swap Out Siri with ChatGPT Not forever, but for now. Until a new, better Siri is
⚡ THN Weekly Recap: Alerts on Zero-Day Exploits, AI Breaches, and Crypto Heists
Monday, March 3, 2025
Get exclusive insights on cyber attacks—including expert analysis on zero-day exploits, AI breaches, and crypto hacks—in our free newsletter. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏
⚙️ AI price war
Monday, March 3, 2025
Plus: The reality of LLM 'research'
Post from Syncfusion Blogs on 03/03/2025
Monday, March 3, 2025
New blogs from Syncfusion ® AI-Driven Natural Language Filtering in WPF DataGrid for Smarter Data Processing By Susmitha Sundar This blog explains how to add AI-driven natural language filtering in the