Thanks
Need to Know Internal modifier & protected Internal with complte example with assembly?
i am confussed about internal and protected internal . I need complete example with code .
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 attend4days leftRegister
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Apr 8, 2010, 9:26 PM EDT
Suppose that
namespace Country
{
public class State
{
// Declare three methods protected internal,protected and internal inclass state of Country library
protected internal void City1
{
// Code
}
protected void City2
{
// Code
}
internal void City3
{
// Code
}
}
// drive new class District from state
public class District : State
{
public District()
{
// we can access all three methods..
City1();
City2();
City3();
}
}
public class Highway
{
public static void Main()
{
State cls = new State();
cls.City1();
cls.City3();
//----------------------------------------
cls.City2(); //--Here we cant access Prtotected Method
//----------------------------------------------
}
}
}
// now wetake an another class library
namespace Water
{
public class River : State
{
public void Main()
{
cls.City1();
cls.City3();
//--Here we cant access internal method
}
}
}
that means protected internal; only derived types or types within the same assembly can access that member, so they need to be in the same Dynamic Link Library or an executable file.
hope your confusion hasbeen cleared
thanks
Please mark as answere if it helps