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

Diagram illustrating C# method parameter passing semantics for ref, out, in, and params.
C#

C# Method Parameters: ref, out, in, params

Understand C# method parameter modifiers: value parameters, ref, out, in, and params. See use cases, code examples, and performance tradeoffs.

C#ref keywordout keywordparams keyword
Technical diagram showing a C# method returning a value to its caller with the return keyword concept
C#

C# Return Statement: Syntax and Behavior

Understand the C# return statement: syntax, compiler requirements, early returns, void methods, tuples, async behavior, and ref returns.

C# methodscontrol flowearly returnsasync programming
Illustration of a C# method with void return type, showing an empty output slot and a gear representing side effects.
C#

C# Void Method: Syntax, Usage, and Common Pitfalls

c# void method: Learn how to declare and use void methods in C#, understand their limitations, and avoid common pitfalls like async void exception handling.

C# methodsvoid return typeasync voidmethod declaration
Illustration of a C# method call showing parameters passing into a method and a return value coming out.
C#

C# Method Call: Syntax, Parameters, and Return Values

Learn how to call methods in C#: syntax, argument passing by value and by reference, return values, named and optional arguments, and overload resolution.

C#Method CallParametersReturn Values
Illustration showing a C# method declaration as a building block of a class, with signature elements labeled visually.
C#

C# Method Declaration: Syntax and Use

Learn C# method declaration syntax, parameters, return types, and overloading with practical examples for everyday development.

C# methodsmethod overloadingaccess modifiersmethod parameters
A diagram showing a C# interpolated string expression being transformed into a formatted output string, with highlighted braces and expressions.
C#

C# Interpolated String Syntax and Usage

Understand C# interpolated string syntax, formatting options, alignment, culture handling, and performance considerations for safer, cleaner string formatting.

C# string interpolationstring formattingC# tips.NET development
Illustration of C# code showing a verbatim string with backslash escapes ignored and a file path as typed.
C#

C# Verbatim String: How to Use @ in C#

C# verbatim strings: Learn how the @ prefix turns off escape sequences and preserves whitespace, and when to use them for paths and regex.

String LiteralsC# SyntaxEscapingRaw Strings
C# raw string literal syntax with multiline text and indentation
C#

C# Raw String Literal Syntax and Use Cases

c# raw string literal: Learn how to use C# raw string literals for multiline text, JSON, and regex without escape sequences, including indentation rules and interpolat...

C# 11raw string literalsstring interpolationcode generation
Insert and remove operations on a StringBuilder, showing index-based edits.
C#

C# StringBuilder Insert and Remove

c# stringbuilder insert remove: Learn how to use StringBuilder.Insert and Remove to modify strings efficiently in C#. Includes syntax, examples, and performance insights.

StringBuilderString ManipulationC# PerformanceMutable Strings
Illustration of a C# char array being converted into a string, showing the transformation from individual characters to a single string object.
C#

Converting a Char Array to a String in C#

Learn the practical ways to convert a char array to a string in C#, including new string(), String.Concat, and StringBuilder, with performance and edge cases.

C#char arraystring conversionString.Concat