Generic methods can overload nongeneric methods
using System; public class Starter{ public static void Main(){ MethodA(5); MethodA(5.0); } public static void MethodA<T>(T arg) { Console.WriteLine("ZClass.MethodA(T arg)"); } public static void MethodA(int arg) { Console.WriteLine("ZClass.MethodA(int arg)"); } public static void MethodA() { Console.WriteLine("ZClass.MethodA()"); } }
1. | This is a prototypical generic method: | ||
2. | Demonstrate a generic method | ||
3. | A prototypical generic method |