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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hirendra SisodiyaPosted Apr 9, 2010, 1:26 AM
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