Internal & Protected Internal
Can any one explain to me c# access specifiers Internal & Protected Internal with example?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mayur GujrathiRank #666 · 3.6K reputationPosted Jun 14, 2011, 10:53 PM EDT
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Jun 14, 2011, 11:21 PM EDT
Internal - The internal can be accessed from same name assembly but not by some other assembly like public.
Protected internal - The protected internal can be accessed by same assembly and derived assembly.
VulpesRank #55 · 29.2K reputationPosted Jun 15, 2011, 12:39 AM EDT
First compile the following as a dll called testdll.dll:
The CLR also has the concept of 'protected AND internal' which means that the member is only accessible from within its class or within a derived class in the same assembly. It's never accessible from a different assembly.
However, neither C# nor VB.Net supports protected AND internal (however C++/CLI and CIL do) so this is academic unless you're using reflection to create a class dynamically.