Udostępnij za pośrednictwem


Cannot implement interface '<interfacename1>' because its implementation could conflict with the implementation of another implemented interface '<interfacename2>' for some type arguments

A class declaration includes an Implements statement that specifies two or more interfaces, but at least one of the interfaces is generic and two of the implementations could conflict for certain values of type arguments.

The following statements can generate this error.

Public Interface iFace1
    Sub testSub(ByVal arg As String)
End Interface
Public Interface iFace2(Of t)
    Sub testSub(ByVal arg As t)
End Interface
Public Class testClass
    Implements iFace1, iFace2(Of String)
End Class

Because iFace2 is constructed using String, testClass must implement two versions of testSub with identical signatures. Doing so would produce an ambiguity about which version to access.

Error ID: BC32072

To correct this error

  • Change the type argument supplied to the generic interface so that there is no conflict.

    -or-

  • Remove from the Implements statement one of the interfaces resulting in the implementation conflict.

See Also

Concepts

Implements Keyword and Implements Statement

Generic Types in Visual Basic

Reference

Class Statement (Visual Basic)

Interface Statement (Visual Basic)

Implements Statement