Skip to content

Instantly share code, notes, and snippets.

@gempir
Last active September 12, 2016 12:21
Show Gist options
  • Save gempir/bb73071da12b379b47e25f333f03421a to your computer and use it in GitHub Desktop.
Save gempir/bb73071da12b379b47e25f333f03421a to your computer and use it in GitHub Desktop.
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