Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0176 Generic methods

Generic method is a method with generic type. using System; class Test { static void print<T>(T t) { Console.WriteLine(t); } static void Main() { print(3); print("rntsoft.com"); } } The output: 3 rntsoft.com