views:

542

answers:

2

I understand access modifiers at the class level and below, but why would an entire assembly be private? I assume by default, assemblies are public?

+5  A: 

Well, in the context of assemblies, private means the assembly cannot be referenced by another application outside the directory it's contained in. Therefore, private to the application it's being used for.

As for your question about the default being public....someone correct me if I'm wrong, but there is no public. It would be shared. A shared assembly can obviously be referenced by multiple applications and must reside in the GAC. All the rules of the GAC would then apply.

Kilhoffer
Technically, you can share assemblies without them residing in the GAC, but it's extremely cumbersome and invasive. See http://www.devcity.net/Articles/254/1/article.aspx for more; but generally I agree that shared assemblies SHOULD be in the GAC. :)
John Rudy
I think they can be called both shared and public, here's a quote from the 'Visual Basic Programming 2008' book'Public assemblies are designed for shared use among multiple .NET applications.'
Omar Abid
+2  A: 

The private in private assembly is not an access modifier. This is just a term used for assembles that are specific to one application - i.e. in this application's directory, as opposed to shared assemblies in the Global Assembly Cache.

Sander
I began to understand... but that was very confusing!!
Omar Abid