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

A magnifying glass inspecting a string with blank spaces, representing the C# IsNullOrWhiteSpace method that detects null, empty, or whitespace-only strings.
C#

C# IsNullOrWhiteSpace: Syntax, Behavior, and Use Cases

Learn how C# IsNullOrWhiteSpace checks for null, empty, and whitespace-only strings, and how to use it in validation.

string validationC# string methodsnull checkswhitespace handling
Illustration of a C# string being checked with IsNullOrEmpty, showing null and empty states.
C#

C# IsNullOrEmpty: Check for Null or Empty Strings

c# isnullorempty: Learn how to use C# String.IsNullOrEmpty to safely check for null or empty strings, avoid exceptions, and write cleaner validation logic.

C#string validationnull checkempty string
A developer inspecting a string variable with a magnifying glass, highlighting the difference between null and empty states in C#.
C#

C# Check Null or Empty String: Methods and Pitfalls

c# check null or empty string: Learn how to check for null or empty strings in C# using IsNullOrEmpty, IsNullOrWhiteSpace, and null-conditional operators, with practic...

C#String ValidationNull HandlingIsNullOrEmpty
Editorial illustration of C# string comparison showing ordinal and culture-aware paths leading to different comparison outcomes.
C#

C# StringComparison: Choosing the Right Comparison Mode

Understand C# StringComparison modes, why culture affects results, and how to choose ordinal or culture-aware comparison to avoid subtle bugs.

StringComparisonCulture-sensitive comparisonOrdinal comparisonString equality
Diagram comparing the == operator and Equals method in C# for value and reference types.
C#

C# Equals vs ==: How They Differ and When to Use Each

c# equals vs ==: Understand the difference between the == operator and the Equals method in C#, including reference vs value types, operator overloading, and practical...

C# equalityoperator overloadingobject comparison.NET
Two string variables being compared with an equals sign, illustrating C# string equality checks.
C#

C# String Equals: Choosing the Right Comparison

Understand C# string equality with ==, Equals, and String.Compare, including ordinal vs. culture-sensitive behavior, null handling, and performance trade-offs.

String ComparisonC# EqualityStringComparisonOrdinal vs Culture
Diagram comparing C# string comparison methods with ordinal and culture-sensitive paths.
C#

C# String Comparison: Ordinal vs Culture

Learn how to compare strings in C#: choose between ordinal and culture-sensitive behavior, use == and Equals effectively, and apply StringComparison when you need explicit control.

StringComparisonOrdinal comparisonCulture-sensitive comparisonString.Equals
C# string case conversion illustration showing uppercase and lowercase letters with culture settings
C#

C# ToUpper and ToLower: String Case Conversion

c# toupper tolower: Learn how to use C# ToUpper and ToLower for string case conversion, including culture-sensitive and invariant overloads, with practical examples an...

C#String ManipulationToUpperToLower
Illustration comparing C# TrimStart and TrimEnd methods on a string with leading and trailing characters.
C#

C# TrimStart vs TrimEnd: When to Use Each

Compare C# TrimStart and TrimEnd: their overloads, behavior with whitespace and character sets, null handling, and practical examples for trimming one side of a string.

C#StringTrimStartTrimEnd
C# string trimming with spaces being removed from both ends of a text string, surrounded by code editor styling.
C#

C# Trim: Removing Whitespace and Characters

c# trim: Learn how to use C# Trim, TrimStart, and TrimEnd to remove whitespace and custom characters from strings, including performance and culture considerations.

string manipulationwhitespace removalC# methodsinput validation