PC Review


Reply
Thread Tools Rate Thread

Class visible only within current project

 
 
google@insightfulmes.com
Guest
Posts: n/a
 
      8th Jan 2007
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

 
Reply With Quote
 
 
 
 
Wouter de Kort
Guest
Posts: n/a
 
      8th Jan 2007
Have a look at the internal access modifier:
http://msdn2.microsoft.com/en-us/library/7c5ka91b.aspx

Greetings,

Wouter de Kort:


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Tom Porterfield
Guest
Posts: n/a
 
      8th Jan 2007
(E-Mail Removed) wrote:
> 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.
--
Tom Porterfield

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make class B visible only to class A inheritors Giulio Petrucci Microsoft C# .NET 3 28th Jul 2008 12:44 PM
Managed C++ Project not visible in C# Project -- Visual Studio 200 =?Utf-8?B?c2FqMTRzYWo=?= Microsoft C# .NET 0 3rd Apr 2006 11:31 PM
The project 'proj1.csproj' must be converted to the current project format error Matt Microsoft ASP .NET 2 16th Aug 2004 12:20 AM
how-to get the name of the current project and class Mark Kamoski Microsoft VB .NET 19 4th Sep 2003 08:24 PM
how-to get the name of the current project and class Mark Kamoski Microsoft ASP .NET 15 4th Sep 2003 08:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:22 AM.