By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,891 Members | 1,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,891 IT Pros & Developers. It's quick & easy.

Sharing a Class Between Applications

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
L#
On Wed, 4 Feb 2004 11:20:44 +0300, "Sajid Saeed"
<hi******@hotmail.com> wrote:
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.
--
Ludwig
mailto:ludwig_(nospamplease)stuyck@pandora(nospamp lease).be
Nov 15 '05 #2

P: n/a
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

"L#" <ludwig_(nospamplease)stuyck@pandora(nospamplease) .be> wrote in message
news:rp********************************@4ax.com...
On Wed, 4 Feb 2004 11:20:44 +0300, "Sajid Saeed"
<hi******@hotmail.com> wrote:
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.
--
Ludwig
mailto:ludwig_(nospamplease)stuyck@pandora(nospamp lease).be

Nov 15 '05 #3

P: n/a
On Wed, 4 Feb 2004 11:46:46 +0300, "Sajid Saeed"
<hi******@hotmail.com> wrote:
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

Nov 15 '05 #4

P: n/a
Hi Sajid,
No, it is not posible.
The only way to access objects from another application domain is remoting.
--
B\rgds
100
"Sajid Saeed" <hi******@hotmail.com> wrote in message
news:eu**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #5

P: n/a
Yes, you will need to use remoting. This is not too difficult.
MSDN has examples.
http://xpcoder.net

"Sajid Saeed" <hi******@hotmail.com> wrote in message news:<eu**************@TK2MSFTNGP11.phx.gbl>...
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

Nov 15 '05 #6

P: n/a
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.

--
William Stacey, MVP

"Benjamin Wootton" <be**************@hotmail.com> wrote in message
news:6j********************************@4ax.com...
On Wed, 4 Feb 2004 11:46:46 +0300, "Sajid Saeed"
<hi******@hotmail.com> wrote:
Hi All,

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

now application APP1, accesses this shared class, and changes the value inthe 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 avalue 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

Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.