Methods, Parameters, and Tuples
Methods group behavior behind a clear contract. Tuples are convenient for returning a small set of related values.
How it works
Define reusable methods with named results and multiple return values.
Named tuple elements make the returned values self-documenting without requiring a dedicated class.
Runnable C# example
Program.cs
using System;
using System.Linq;
class Program
{
static (int Min, int Max) Range(int[] values)
=> (values.Min(), values.Max());
static void Main()
{
var range = Range(new[] { 8, 3, 14, 5 });
Console.WriteLine($"{range.Min}..{range.Max}");
}
}
3..14Practice with the debugger
Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.