Hi, my name is Alex. I'm fairly new to C# but apparently I may be required to know how to manipulate .NET Frameworks via C# so I am studying a beginners book and another book to thoroughly understand the language.

The problem is that I am struggling to understand the concept of the internal command.

As quoted from the 2nd book I'm reading--

"...On the other hand, if a class is internal, the semantics of access modifies is identical to those of a public class except for one key restriction: Acces is limited to those classes within the same compiled unit. Otherwise, no method or data field of an internal class is directly accessible among classes that are compiled separately."

It seems straightforward, but now I'm curious as to how a class is considered to be in our outside of a compiled unit?

For example, if I include ('using') a class to be used within the current C# program, is that class now included in the compiled unit also, and therefore I have access to its internal methods? Or is the compiled unit strictly the classes within the initial namespace (or in a namespace)?

Also, if C# is like C++ where you can use other namespaces in a given namespace, will the namespace that is included be a part of the compiled unit?

Any explanation to clear up this mist would be nice. Thank you!

-Alex

Recommended Answers

All 2 Replies

The internal keyword is an access modifier for types and type members. Internal types or members are accessible only within files in the same assembly

if you are using other dll's you can't access their internal classes or properties.

http://msdn.microsoft.com/en-us/library/7c5ka91b(VS.80).aspx check this url for examples

commented: Thank you =) +3

if you are using other dll's you can't access their internal classes or properties.

http://msdn.microsoft.com/en-us/library/7c5ka91b(VS.80).aspx check this url for examples

It seems that I need to continue reading and get a thorough grasp on how assemblies are used in C# before I can really understand the difference.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.