Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify a method that can be accessed only from derived classes of the same assembly?

Tags:

c#

.net

Is there any way in C# to specify a method that can be accessed only from derived classes of the same assembly without using internal access modifier?

Thanks.

like image 975
abenci Avatar asked May 26 '11 07:05

abenci


2 Answers

You have to specify both internal as well as protected.

like image 107
Akash Kava Avatar answered Sep 29 '22 05:09

Akash Kava


Give the scope of the class as internal and method scope as protected

Internal class Myclass
{
    Protected void MyMethod()
    {
        //Do something
    }
}
like image 25
Umesh CHILAKA Avatar answered Sep 29 '22 06:09

Umesh CHILAKA