1

Possible Duplicate:
How to make protected AND internal?

i.e. it is an internal member, and can only be accessed from a class deriving from this class.

Community
  • 1
  • 1
Louis Rhys
  • 34,517
  • 56
  • 153
  • 221
  • `protected internal` means it can be accessed by anyone either within the assembly or deriving from the class, but not necessarily both, if that's what you're looking for. – BoltClock Mar 03 '11 at 03:27
  • 1
    Duplicate of http://stackoverflow.com/questions/941104/how-to-make-protected-and-internal? – Mark Sowul Mar 03 '11 at 03:34

4 Answers4

7

All these answers are backwards: protected internal is available to derived classes OR other objects in the same (or InternalsVisibleTo) assembly. What you want is not possible and as Eric Lippert points out, not really useful, or at the least, something you shouldn't expect anytime soon: http://blogs.msdn.com/b/ericlippert/archive/2008/04/24/why-can-t-i-access-a-protected-member-from-a-derived-class-part-three.aspx

Mark Sowul
  • 10,244
  • 1
  • 45
  • 51
  • Why would not "protected and internal" be the most logical storage class for a protected member which uses an internal type? From what I can tell, if a member which uses internal type needs to be visible to descendant classes, the only usable access modifier is "internal", which means the field must be made visible to all classes within the assembly even when such visibility would violate the Liskov Substitution Principle. – supercat Aug 10 '11 at 22:24
1

using protected internal Access Modifier - http://msdn.microsoft.com/en-us/library/ms173121.aspx

Kumar
  • 997
  • 5
  • 8
0

there is a protected internal access identifier. You can use that.

sajoshi
  • 2,733
  • 1
  • 18
  • 22
0

Just use both access specifiers..

    protected internal void method()
    {
    }
Jimmy
  • 6,001
  • 1
  • 22
  • 21