How to connect two classes in a namespace?

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

    How to connect two classes in a namespace?

    I have a solution with a project names
    ProjA and ProjB. In ProjA i have a class
    called ClassA. It contains a static,
    public member MembA.

    I'd like to read MembA when executing
    code in class ClassB in the project
    ProjB, but when i try the following, i
    get nothing from Intellisense (and it
    doesn't compile either).

    ClassA.MembA = null;

    The error is as follows.
    "The type or namespace name 'ClassA' could
    not be found (are you missing a using
    directive or an assembly reference?)"

    However, them being in the same namespace
    mean that they know about eachother,
    doesn't it?

    Or is it required to reference projects
    in the same namespace and the same solution?!

    --
    Regards
    Konrad Viltersten
    ----------------------------------------
    May all spammers die an agonizing death;
    have no burial places; their souls be
    chased by demons in Gehenna from one room
    to another for all eternity and beyond.


  • Marc Gravell

    #2
    Re: How to connect two classes in a namespace?

    If they are different project, then a reference will be needed to see
    the other type. Note that you should avoid circular references (A
    references B and B references A) - in fact, the IDE won't let you do
    this [you can do it at the command line if you try hard enough].

    Marc

    Comment

    • K Viltersten

      #3
      Re: How to connect two classes in a namespace?

      If they are different project, then a reference will be needed to see the
      other type.
      When i tried adding the project as a
      reference, i got a lot of errors about
      XML files mentioned in ClassA.exe.mani fest
      but not being found. Any thoughts?

      --
      Regards
      Konrad Viltersten
      ----------------------------------------
      May all spammers die an agonizing death;
      have no burial places; their souls be
      chased by demons in Gehenna from one room
      to another for all eternity and beyond.


      Comment

      • Marc Gravell

        #4
        Re: How to connect two classes in a namespace?

        Not without more info - but the simplest answer here is to put the
        shared types into a dll, and reference that dll from both projects.
        References to exes are possibly, but aren't as well supported (VS2005
        didn't support it at all IIRC).

        Marc

        Comment

        • K Viltersten

          #5
          Re: How to connect two classes in a namespace?

          Hmm... It seems you're thinking "types" as
          in "classes". However, the problem i ran
          into was that the manifest file complained
          about XML files (normal data, nothing
          fancy) being not found.

          I solved it by referencing the executble
          directly, instead of the project but i'm
          unsure if that's a good solution (or a
          solution at all). This area isn't exactly
          my forte.

          --
          Regards
          Konrad Viltersten
          ----------------------------------------
          May all spammers die an agonizing death;
          have no burial places; their souls be
          chased by demons in Gehenna from one room
          to another for all eternity and beyond.
          "Marc Gravell" <marc.gravell@g mail.comskrev i meddelandet
          news:%23%235HVB XGJHA.1272@TK2M SFTNGP05.phx.gb l...
          Not without more info - but the simplest answer here is to put the shared
          types into a dll, and reference that dll from both projects. References to
          exes are possibly, but aren't as well supported (VS2005 didn't support it
          at all IIRC).
          >
          Marc

          Comment

          • Pavel Minaev

            #6
            Re: How to connect two classes in a namespace?

            On Sep 18, 1:13 pm, "K Viltersten" <t...@vilterste n.comwrote:
            If they are different project, then a reference will be needed to see the
            other type.
            >
            When i tried adding the project as a
            reference, i got a lot of errors about
            XML files mentioned in ClassA.exe.mani fest
            but not being found. Any thoughts?
            Can you give the exact error message, please, along with the content
            of the .manifest?

            Comment

            • K Viltersten

              #7
              Re: How to connect two classes in a namespace?

              >>If they are different project, then a
              >>reference will be needed to see the
              >>other type.
              >>
              >When i tried adding the project as a
              >reference, i got a lot of errors about
              >XML files mentioned in ClassA.exe.mani fest
              >but not being found. Any thoughts?
              >
              Can you give the exact error message,
              please, along with the content of the
              .manifest?
              It was in swedish, so no, but it said that
              the file ThisAndThat.XML mentioned in
              ThatRunnable.ex e.manifest couldn't be
              located.

              Right now, i referenced the EXE file hoping
              that it's good enoough.

              --
              Regards
              Konrad Viltersten
              ----------------------------------------
              May all spammers die an agonizing death;
              have no burial places; their souls be
              chased by demons in Gehenna from one room
              to another for all eternity and beyond.


              Comment

              Working...