Just like a *.h file in C/C++, each project needs to reference a copy of the
file, the difference being that in C/C++ it was a little easier to say “Use
this .h file in this random, far off folder.”
To do what you are looking for, you’ve got two main options, the first is an
external class library (which is preferred IMO), otherwise you can ‘link’ the
file when you add it to the project.
To link it, go through the regular Add Existing Item process, but before
hitting the open button to finally do so, click the little triangle that is
part of it and choose link. This will setup a link in the project to the file
in the other directory.
Alternatively (if your class is much larger and going to be used by multiple
applications (as well as potentially other developers)), I would suggest
looking into using a class library where that you would build your custom
class into, and then all programs that need access can easily reference it
and use it as needed.
Brendan
"Dave" wrote:
Hi,
can i do in c# something identical to an *.h file used in c++ so i can
share class code betwine many application i try to add cs file to my project
but it copy the file to the solotion directory so if i change it it impact
only the current poject but i whant to put a file in spcific directory and
use it from many c# projects.
thanks