0
using System;

public class Test
{
    static void Main()
    {
        PrintMethod("Hello World");
    }
    
    static void PrintMethod(object x)
    {
        Console.WriteLine("object called");
    }
    
    static void PrintMethod<T>(params T[] x)
    {
        Console.WriteLine("params T method called[]");
    }
}

Output: params T method called[]

Can someone help me with the explanation? I want to know why we are not using first printMethod

Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188
Shristi
  • 17
  • 3

1 Answers1

-1

Check here about function overloading order.

The idea is that object is always last in overload order.

Ygalbel
  • 5,214
  • 1
  • 24
  • 32