Question Why can I access a class scoped as INTERNAL from another assembly?

Neal

Forum Admin
Staff member
Joined
Apr 15, 2011
Messages
219
Location
VA
Programming Experience
10+
Hello,

I'm not sure if this is a Mono bug (MonoTouch 4.0.0 with MonoDevelop 2.4.2) but I have a class library and in that class library I have a class named "Logger" which is used to write error data to a file. I have this class scoped as INTERNAL. From my main app I have the using statement to import this class library's namespace. Why is it that I can use this Logger class from the main project if this class is marked as INTERNAL?

I have a Logger class within the main project itself which is a little different. The one in the class library is to be used only by that library so I scoped it as INTERNAL. Come to find out when I was making "Logger.LogException" calls it was using the INTERNAL one.

Anyone have any thoughts? I thought INTERNAL was the same as FRIEND in VB?

Thx
 

JohnH

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
1,559
Location
Norway
Programming Experience
10+
It is the same, internal access is within assembly. Though it is possible to apply InternalsVisibleToAttribute to make friend assemblies. Reflection can also access it.
 
Top Bottom