Sharing a Class Between Applications

  • Thread starter Thread starter Sajid Saeed
  • Start date Start date
S

Sajid Saeed

Hi All,

I wuld like to know if there is any possibility of sharing a common class
between different applications.
i.e. if the two applications are running, they can share the class, and
changes made to class from one application should be visible in the other
application.

Thanks in advance

Sajid Saeed
 
Hi All,

I wuld like to know if there is any possibility of sharing a common class
between different applications.
i.e. if the two applications are running, they can share the class, and
changes made to class from one application should be visible in the other
application.

Thanks in advance

Sajid Saeed

Ceate a new class library project, create your shared classes there
and give them a good namespace name, like YourName.Shared or something
like that.

In you other projecs, add a reference to the assemblie of above class
library project, put a 'using YourName.Shared;' on top and the classes
become available.
 
Hi All,

lets say we have a variable in our shared class, for arguments sake let it
be x, and has a value of 2.

now application APP1, accesses this shared class, and changes the value in
the shared class variable x, so now x has a value of 5

the application App2, now also accesses the shared class variable and
changes it to a value of 25, so x is now 25.

now when APP1, access the value of the shared class again, it should see a
value of 25.

is this doable and how?

Thanks in advance.

Sajid Saeed
 
Hi All,

lets say we have a variable in our shared class, for arguments sake let it
be x, and has a value of 2.

now application APP1, accesses this shared class, and changes the value in
the shared class variable x, so now x has a value of 5

the application App2, now also accesses the shared class variable and
changes it to a value of 25, so x is now 25.

now when APP1, access the value of the shared class again, it should see a
value of 25.

is this doable and how?

One option is to use something like .NET remoting such that the object
lives in one applicaiton domain, and your applications talk to the
object as a remote object - even though it's on the same machine.

HTH
Ben
 
Hi Sajid,
No, it is not posible.
The only way to access objects from another application domain is remoting.
 
Your talking about different applications which means different processes
and appdomains, so to share data you need:
1) remoting/web services, or sockets
2) MMF, Named Pipes or other. Memory Mapped File (MMF) is probably best for
sharing a struct.
 
Back
Top