Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

StringExamples - String Manipulation and Comparison in C#

YouTube Blog Newsletter All Links LinkedIn

This educational solution contains two console applications demonstrating C# string handling best practices. The StringBuilderExamples project shows the performance difference between naive string concatenation and using StringBuilder, illustrating why StringBuilder is preferred for repeated string modifications in loops and hot paths.

The StringComparisonExamples project demonstrates different string comparison methods in C#, including the == operator, String.Equals(), and String.Compare() with various StringComparison options. It covers ordinal, case-insensitive, and culture-aware comparison scenarios to help developers choose the right approach for their use case.

Built on .NET 7 with no external dependencies, this project is a straightforward reference for understanding string performance and comparison semantics in C#.

Getting Started

Prerequisites

  • .NET 7.0 SDK

Running the Project

# Run the StringBuilder examples
cd StringBuilderExamples
dotnet run

# Run the String Comparison examples
cd StringComparisonExamples
dotnet run

Newsletter

If you found this useful and you want to learn more about C#, .NET, and software engineering, subscribe to the free Dev Leader Weekly newsletter:

Subscribe to Dev Leader Weekly

Connect with Dev Leader


BrandGhost

Powered by BrandGhost 👻