Last active
September 12, 2016 12:21
-
-
Save gempir/bb73071da12b379b47e25f333f03421a to your computer and use it in GitHub Desktop.
This file contains 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
using System; | |
namespace a | |
{ | |
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
UseParams(1,2,3,4); | |
int[] myIntArray = { 5, 6, 7, 8, 9 }; | |
UseParams(myIntArray); | |
object[] myObjArray = { 2, 'b', "test", "again" }; | |
UseParams(myObjArray); | |
Console.ReadKey(); | |
} | |
public static void UseParams<T>(params T[] arr) | |
{ | |
foreach (var element in arr) | |
{ | |
Console.WriteLine(element); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment