Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Static class info across multiple application instances?

Static class info across multiple application instances?

Scheduled Pinned Locked Moved C#
question
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jacobus01
    wrote on last edited by
    #1

    If I change a static class variable in one application instance and I have multiple instantiated applications using the same dll will I be able to see that specific modification from one of my other applications? I'm thinking yes but I'd like to know for a fact. Any words of wisdom? Thanx

    L S 2 Replies Last reply
    0
    • J Jacobus01

      If I change a static class variable in one application instance and I have multiple instantiated applications using the same dll will I be able to see that specific modification from one of my other applications? I'm thinking yes but I'd like to know for a fact. Any words of wisdom? Thanx

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      No. Instance data as well as static data only exists inside a single process. In order to share data amongst applications, you must take special steps and use one of many available mechanisms, e.g. memory-mapped files. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      J E 2 Replies Last reply
      0
      • L Luc Pattyn

        No. Instance data as well as static data only exists inside a single process. In order to share data amongst applications, you must take special steps and use one of many available mechanisms, e.g. memory-mapped files. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        J Offline
        J Offline
        Jacobus01
        wrote on last edited by
        #3

        Can you maybe elaborate on these mechanisms?

        L 1 Reply Last reply
        0
        • J Jacobus01

          Can you maybe elaborate on these mechanisms?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          There are lots of mechanisms; whatever your need may be, a few of them will fit well. Search for "interprocess communication", and read the documentation, there is plenty of it. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


          J 1 Reply Last reply
          0
          • L Luc Pattyn

            There are lots of mechanisms; whatever your need may be, a few of them will fit well. Search for "interprocess communication", and read the documentation, there is plenty of it. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


            J Offline
            J Offline
            Jacobus01
            wrote on last edited by
            #5

            Thank you

            1 Reply Last reply
            0
            • J Jacobus01

              If I change a static class variable in one application instance and I have multiple instantiated applications using the same dll will I be able to see that specific modification from one of my other applications? I'm thinking yes but I'd like to know for a fact. Any words of wisdom? Thanx

              S Offline
              S Offline
              S Senthil Kumar
              wrote on last edited by
              #6

              Remoting the static instance is an option. Remoting offers out of the box support for singletons.

              Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

              1 Reply Last reply
              0
              • L Luc Pattyn

                No. Instance data as well as static data only exists inside a single process. In order to share data amongst applications, you must take special steps and use one of many available mechanisms, e.g. memory-mapped files. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                E Offline
                E Offline
                ely_bob
                wrote on last edited by
                #7

                This isn't fully correct... there is a method.. not for the feint of heart.. you can go into the .prj (or.sln) file and make a manual reference to the location of the dll that you compile from the static class (for each project that you want to reference that particular dll) I've never done it (needed to do it) myself but I've heard about it... come to think of it you can basically do this by add>existing project> your_dll.sln then whenever you modify your_dll.sln it will be compiled into your other programs.. did I ramble.. sorry.

                L 1 Reply Last reply
                0
                • E ely_bob

                  This isn't fully correct... there is a method.. not for the feint of heart.. you can go into the .prj (or.sln) file and make a manual reference to the location of the dll that you compile from the static class (for each project that you want to reference that particular dll) I've never done it (needed to do it) myself but I've heard about it... come to think of it you can basically do this by add>existing project> your_dll.sln then whenever you modify your_dll.sln it will be compiled into your other programs.. did I ramble.. sorry.

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  ely_bob wrote:

                  whenever you modify your_dll.sln it will be compiled into your other programs..

                  you can add the same code to several processes, that does not magically make them share some data; unless the code you are sharing is taking care of interprocess communication, but then you don't need a DLL for that.

                  ely_bob wrote:

                  did I ramble

                  a bit (if not a byte) :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups