name_optional_parameter

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		Test(a: 4);
		Test(b: 5);
		Test(c: 6);
		Test(a: 4, b: 5);
		Test(a: 4, c: 6);
		Test(b: 5, c: 6);
		Test(a: 4, b: 5, c: 6);
		Test(b: 5, c: 6, a: 4);
		Test(b: 5, a: 4, c: 6);
	}
	
	public static void Test(int a = 1, int b = 2, int c = 3)
	{
		Console.WriteLine(String.Format("a={0},b={1},c={2}",a,b,c));
	}
}
;