Last active
April 6, 2025 21:36
-
-
Save AnthonyGiretti/512a281d7bb8e161cc50ca50936b4b45 to your computer and use it in GitHub Desktop.
C# 12 and before params
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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