Circular Reference problem..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • babylon

    Circular Reference problem..

    Class A stores in assembly a.dll
    Class B stores in assembly b.dll

    Class A would like to reference a class b object and
    class B would also like to reference a class a object
    e.g.
    Class A
    {
    private B;
    }

    Class B
    {
    private A;
    }

    how can it be done?
    coz i need to add reference to both project before I can compile them,
    but I won't able to create the dll for both classes without compiling
    them.....
    so...

    thx..


  • Michael Culley

    #2
    Re: Circular Reference problem..

    "babylon" <amuro@hotmail. com> wrote in message news:#mQUlaboDH A.964@TK2MSFTNG P10.phx.gbl...
    You can't do this but there are way around it. One method is to have one class keep a reference to the other as object (probably not
    what you are after). The other method is to have one of the classes implement an interface that is defined in the other dll. That
    way the interface for class A and class B are both defined in the same dll so both classes can each other.

    --
    Michael Culley


    Comment

    • babylon

      #3
      Re: Circular Reference problem..

      icic...thx!
      "Michael Culley" <mculley@NOSPAM optushome.com.a u> wrote in message
      news:etDjbsboDH A.1672@TK2MSFTN GP09.phx.gbl...[color=blue]
      > "babylon" <amuro@hotmail. com> wrote in message[/color]
      news:#mQUlaboDH A.964@TK2MSFTNG P10.phx.gbl...[color=blue]
      > You can't do this but there are way around it. One method is to have one[/color]
      class keep a reference to the other as object (probably not[color=blue]
      > what you are after). The other method is to have one of the classes[/color]
      implement an interface that is defined in the other dll. That[color=blue]
      > way the interface for class A and class B are both defined in the same dll[/color]
      so both classes can each other.[color=blue]
      >
      > --
      > Michael Culley
      >
      >[/color]


      Comment

      Working...