Exposing properties and methods

G

Guest

How do you make a program's properties and methods availale so that other
programs can "connect" to them at design time and then use them at run time?
 
G

Guest

Just about any assembly you build is capable of being used by another
application. If the project you are building outputs to a class library, all
public classes and public methods (within public classes) will be accessible
to the outside (of the DLL) world.

Once your DLL is built, you need only add a reference from another
application (or library) to use it. One note though, depending on how you
intend your library to be used, you may want to give it a strong name so that
it can be installed in the GAC.

No need to write horrible .def files or define the function in six and a
half places as you would when exposing things from a C++ DLL.

Does that answer your question?

Brendan
 
B

Bruce Wood

You don't typlically make a _program's_ properties and methods
available to other programs. Usually you put common classes in a DLL,
which is a separate project, and then put that DLL in your "References"
section of projects that want to use those common classes.

In other words, you have to separate the common code from the code
that's specific to your application, and put that common code in a
separate project.
 
J

Jon Skeet [C# MVP]

FredC said:
How do you make a program's properties and methods availale so that other
programs can "connect" to them at design time and then use them at run time?

You need to make them public, and part of a class library. The
"client" programs will then add a reference to your library.

Under the hood, .NET actually lets you refer to executable assemblies,
but VS.NET doesn't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top