There are three main methods to check for a string, within a string. Those methods, from String, are: Contains(), StartsWith(), and EndsWith(). This article shows the performance differences between these methods. Updated February 2023.
Month: November 2021
String Performance: Encoding and Decoding Strings
Encoding and decoding strings to and from a byte[] is used a lot in programming. Performance results are for using the formatting options ASCII, Unicode, UTF8, and UTF32, Latin and BigEndianUnicode. Updated February 2023
Rockin’ The Code World with dotNetDave – Guest: Scott Hunter
Join me live on Saturday, November 13th, 2021 at 10:00 PST on C# Corner Live for show #42 where I will be interviewing for the second time Scott Hunter, Director Program Management .NET. Learn the latest about .NET 6 from the person in charge of it!Â
String Performance: Combining Strings with the StringBuilder
In programming, efficient string concatenation is crucial. Utilizing the StringBuilder class, especially within loops, offers better performance and reduced memory usage. Methods like AppendFormat() and AppendLine() provide formatting and localization benefits. Benchmark results show StringBuilder's significant speed advantage, with minimal memory allocations. Consistently using StringBuilder for string concatenation is recommended.
String Performance: Concatenating Strings
In .NET, string concatenation should be approached carefully due to immutability. Using Concat() or Join() for combining strings from an array is advised for better performance and memory allocation. Avoid using += or + as they lead to significant performance decline and larger memory allocations. StringBuilder can also enhance performance.
Internationalization and Localization: Overview
These articles will show when you need to use globalization, even when the performance might not be the best. Believe me, you will thank me later. I typically do not use globalization patterns for application logging. Updated February 2023.
String Performance: Formatting
This article discusses the performance differences using string.Format() and interpolation and stresses the importance of using globalization with any string shown to the user. Updated January 2023.
Evil Software Of The Month
There is pleanty of bad software out there, stealing your data and much more. I've decided to give awards out to software that I call "evil". I feel this software should not be on the market or needs major changes to be safe and secure for its users.
Collection Performance: A Comprehensive Benchmark Analysis of Collection Types in .NET Beyond Arrays and Lists
This article conducts a comprehensive benchmark analysis of various collection types in .NET beyond arrays and lists. It explores the performance of iteration methods, revealing significant differences among types, providing valuable insights for developers to choose the most performant collection type based on their code requirements.

You must be logged in to post a comment.