circular dependencies between dlls with visual studio

前端 未结 9 1138
忘掉有多难
忘掉有多难 2020-12-15 08:00

I have a circular dependency between two functions. I would like each of these functions to reside in its own dll. Is it possible to build this with visual studio?



        
9条回答
  •  生来不讨喜
    2020-12-15 08:34

    How about this:

    Project A

    Public Class A Implements C.IA

    Public Function foo(ByVal value As C.IB) As Integer Implements C.IA.foo
        Return value.bar(Me)
    End Function
    

    End Class

    Project B

    Public Class B Implements C.IB

    Public Function bar(ByVal value As C.IA) As Integer Implements C.IB.bar
        Return value.foo(Me)
    End Function
    

    End Class

    Project C

    Public Interface IA
        Function foo(ByVal value As IB) As Integer
    End Interface
    
    Public Interface IB
        Function bar(ByVal value As IA) As Integer
    End Interface
    

    Project D

    Sub Main()
    
        Dim a As New A.A
        Dim b As New B.B
    
        a.foo(b)
    
    End Sub
    

提交回复
热议问题