为什么这个电话不明确?

ima*_*huk 6 c# extension-methods visual-studio-2008 c#-3.0

任何人都可以解释,为什么以下代码产生错误?(在Microsoft Visual Studio 2008中编译)

class Base1 {  };
class Base2 {  }

interface I1   {   }
interface I2   {   }

class C : I1, I2 { }

static class Program
{

    static T M1<T>(this T t, I1 x) where T : Base1
    {
        return t;
    }

    static T M1<T>(this T t, I2 x) where T : Base2
    {
        return t;
    }

    static void Main(string[] args)
    {
        Base1 b1 = new Base1();
        C c = new C();
        b1.M1(c);
    }
}
Run Code Online (Sandbox Code Playgroud)

错误是

以下方法或属性之间的调用不明确:' ConsoleApplication1.Program.M1<ConsoleApplication1.Base1>(ConsoleApplication1.Base1, ConsoleApplication1.I1)'和' ConsoleApplication1.Program.M1<ConsoleApplication1.Base1>(ConsoleApplication1.Base1, ConsoleApplication1.I2)'

我认为编译器可以使用"where"子句区分两种方法

Mik*_*wan 13

约束不是方法签名的一部分,因此不用于解决.