Skip to content

Instantly share code, notes, and snippets.

@gempir
Created September 12, 2016 12:26
Show Gist options
  • Save gempir/0c00d66df75eea3f0252dd8c93daa1cb to your computer and use it in GitHub Desktop.
Save gempir/0c00d66df75eea3f0252dd8c93daa1cb to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
namespace a
{
class Program
{
public static void Main(string[] args)
{
List<int> list = getList(1,2,3,4);
Console.ReadKey();
}
public static List<T> getList<T>(params T[] arr)
{
List<T> list = new List<T>();
foreach (var element in arr)
{
list.Add(element);
}
return list;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment