Class visible only within current project

G

google

Is it possible to add a class, coded within a separate .cs file, that
is available only within the project?

I hope that is clear. In more detail - I want to write a DLL for
distribution that exposes one public class. I have some utilities
classes that I would like to use in my public class but not expose to
the end user. I was hoping that I just include the source file.

What I'm trying to do is make a "private" class, but that's not allowed
as I'm trying to use it.

I suppose that I could make a separate DLL for the utility classes and
then reference that DLL from the main DLL.

Mike Buchanan
 
T

Tom Porterfield

Is it possible to add a class, coded within a separate .cs file, that
is available only within the project?

I hope that is clear. In more detail - I want to write a DLL for
distribution that exposes one public class. I have some utilities
classes that I would like to use in my public class but not expose to
the end user. I was hoping that I just include the source file.

What I'm trying to do is make a "private" class, but that's not allowed
as I'm trying to use it.

I suppose that I could make a separate DLL for the utility classes and
then reference that DLL from the main DLL.

Mike Buchanan

Mark the classes as internal, rather than public/private/protected and they
will be accessible only within your assembly. So you will be able to use
them throughout your assembly but they will not be accessible to anyone who
is referencing your assembly.
 

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