Generic methods can overload nongeneric methods

image_pdfimage_print


   


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()");
        }
}

           
          


This entry was posted in Generics. Bookmark the permalink.