Browse by Topic

Popular

Latest

Latest C# Posts

Illustration of a C# method returning multiple values using a tuple, showing the concept of multiple return values.
C#

C# Return Multiple Values: Tuples, Out Parameters, and Custom Types

Learn how to return multiple values from C# methods using tuples, out parameters, and custom types, with code examples and tradeoffs.

C#TuplesOut ParametersValueTuple
Diagram showing multiple method signatures with the same name resolving to different implementations in C#.
C#

C# Method Overloading Rules: How Resolution Works

Understand C# method overloading: valid signatures, overload resolution, optional and named arguments, ref/out/in, params arrays, and common ambiguity pitfalls.

C#Method OverloadingOverload ResolutionMethod Signatures
Diagram showing multiple C# method signature cards converging into a single resolved overloaded method call
C#

C# Method Overloading: Syntax, Rules, and Practical Use

Learn how C# method overloading works: signature rules, compiler resolution, common mistakes, and when generics or optional parameters fit better.

method overloadingC# syntaxoverload resolutionoptional parameters
Comparison of C# ref, in, and out parameter modifiers with arrows showing data flow.
C#

C# ref vs in vs out: Choosing the Right Parameter Modifier

Understand the differences between C# ref, in, and out parameter modifiers, when to use each, and how they affect performance and code clarity.

C#refinout
Illustration of C# in parameter passing a struct by reference without copying
C#

C# in Parameter: Read-Only References for Structs

Learn how the C# in parameter passes structs by read-only reference, avoids copying for large values, and affects overload resolution and performance.

C#structsmethod parametersread-only
Diagram showing a C# method with an out parameter returning a value to a caller.
C#

C# Out Parameter: How to Use It Correctly

c# out parameter: Learn how to use C# out parameters: syntax, initialization rules, common patterns like TryParse, and when to prefer out over ref or return values.

out parameterC# methodsref vs outTryParse pattern
Diagram showing a ref parameter pointing to the same memory location as the original variable in C#.
C#

C# ref Parameter: How It Works and When to Use It

Understand how C# ref parameters work, when to use them, and how they differ from out and in parameters in practical code.

C#ref keywordmethod parametersvalue types
Illustration of a C# method accepting a variable number of arguments through the params keyword, shown as multiple values flowing into a single array parameter.
C#

Using the C# params Keyword for Variable Arguments

Understand the C# params keyword: syntax, compiler behavior, overload resolution, allocation costs, edge cases, and when an explicit array parameter is a better choice.

C#params keywordvariable argumentsmethod overloading
Diagram showing named arguments mapping parameter names to values in a C# method call.
C#

C# Named Arguments: Syntax and Usage

Learn how to use C# named arguments, including syntax, placement rules, optional parameters, and readability tradeoffs.

C#named argumentsmethod parametersoptional parameters
C# code snippet showing a method with optional parameters and default values
C#

C# Optional Parameters: Syntax, Behavior, and Pitfalls

c# optional parameters: Learn how C# optional parameters work, including default value rules, named arguments, and pitfalls like ambiguous calls.

optional parametersmethod overloadingnamed argumentsdefault values