Pages

Topics

Tools

↑↓navigate↵openescclose

C# guides

Every published C# guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest C# guides

C# code snippet showing LastIndexOf used to find the last dot in a file name.
C#

Find the Last Occurrence with C# LastIndexOf

c# lastindexof: Learn C# LastIndexOf syntax, overloads, and practical use cases to find the last occurrence of a character or substring in a string.

C# string manipulationIndexOfString search.NET
Diagram showing a magnifying glass over a string with highlighted index positions, representing the IndexOf method in C#.
C#

Using C# IndexOf Effectively

Learn how to use the IndexOf method in C# on strings and collections, including overloads, comparison rules, error handling, and practical tradeoffs.

string searchIndexOfC#substring
C# string prefix and suffix comparison with StartsWith and EndsWith methods
C#

C# String StartsWith and EndsWith Usage

Learn how to use C# StartsWith and EndsWith methods for string prefix and suffix checks, including overloads, StringComparison, culture considerations, and practical examples.

String MethodsC# ProgrammingString ComparisonText Processing
Illustration of a C# string being checked for a substring with case-insensitive comparison options.
C#

C# String Contains: Usage, Case-Insensitive Checks, and Performance

Learn how to use C# String.Contains, handle case sensitivity with StringComparison, and choose between ordinal and culture-sensitive comparisons.

String.ContainsStringComparisoncase-insensitiveC# string performance
Illustration of C# string.Join concatenating an array of strings with a comma separator
C#

C# String Join: Syntax, Overloads, and Practical Usage

Learn how to use string.Join in C# to concatenate arrays and collections, choose the right overload, handle null elements, and avoid common pitfalls.

C#String.JoinStringBuilderLINQ
Illustration of a string being split into segments by a delimiter, representing the C# String.Split method.
C#

C# String Split: Overloads, Options, and Pitfalls

Learn how to use C# String.Split for real-world parsing: overloads, delimiter types, StringSplitOptions, performance trade-offs, and common pitfalls with practical examples.

C#String.SplitString Parsing.NET
A visual metaphor showing a string being sliced into segments, with one segment highlighted to represent the substring extraction range in C#.
C#

C# Substring: Syntax, Errors, and Alternatives

Learn how to use the C# Substring method correctly: syntax, boundary rules, common patterns, and allocation-aware alternatives for high-throughput code.

C# StringString ManipulationSubstring MethodReadOnlySpan
Illustration of a string with a measurement ruler, symbolizing the C# string Length property and its code unit counting.
C#

C# String Length: Property, Pitfalls, and Performance

Understand the C# string Length property, including UTF-16 code units, null handling, and performance trade-offs.

C#String LengthUTF-16Unicode
Illustration of C# string format placeholders and format specifiers in a code editor.
C#

C# String Format: Composite Formatting and Specifiers

c# string format: Learn C# string format with composite formatting, format specifiers, alignment, culture handling, and performance tradeoffs.

C#String.FormatComposite FormattingString Interpolation
Diagram showing C# string interpolation with format specifiers and alignment, illustrating how values are inserted into a template.
C#

C# String Interpolation Formatting: Syntax and Specifiers

C# string interpolation formatting: alignment, format specifiers, culture handling, common pitfalls, and performance tradeoffs.

C#String InterpolationFormat Specifiers.NET