Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiretti
Last active April 6, 2025 21:36
Show Gist options
  • Save AnthonyGiretti/512a281d7bb8e161cc50ca50936b4b45 to your computer and use it in GitHub Desktop.
Save AnthonyGiretti/512a281d7bb8e161cc50ca50936b4b45 to your computer and use it in GitHub Desktop.
C# 12 and before params
void PrintNumbers(params int[] numbers)
{
foreach (var number in numbers)
Console.WriteLine(number);
}
var myList = new List<int> { 1, 2, 3 };
PrintNumbers(myList.ToArray());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment