Here's an example of a generic function in C#:
using System;
using System.Linq;
using System.Collections.Generic;
public class test{
public static void Main(){
//create two random sets of enumerable things
var list = Enumerable.Range(1,2);
var list2 = new string[]{"hello_1", "hello_2"};
PrintList(list);
PrintList(list2);
}
public static void PrintList<T>(IEnumerable<T> entries){
foreach(T s in entries)
Console.WriteLine(s + ":" + typeof(T));
}
}
output:
1:System.Int32
2:System.Int32
hello_1:System.String
hello_2:System.String