Suppose that you have a control (or whatever kind of entity) library in an
assembly. All the controls of the library are derived from a base class.
Furthermore, you want to offer the chance of others to build controls
derived from the base class of your control library but you want to expose
only a subset of the methods of the base class to "external" controls, that
is, "internal" controls of the library take advantage of some methods of the
base class that for whatever reasons you don´t want to offer to "external"
controls. Currently you have two options:
1) Make another base class with friend (internal) scope derived from the
public one, move the methods available only to "internal" controls to it and
derive the "internal" controls from it instead of from the original base
class. But those methods may need to call private methods of the original
base class that now are not accessible to them...
2) Change the scope of methods only available to "internal" controls from
protected to friend (internal). This hides the methods to "external"
controls but exposes them to classes inside the assembly that are not
derived from the base class, which is not 100% ideal.
So, what is needed in this scenario is an accesibility level of "Protected
And Internal" (meaning "Protected INTERSECT Internal") and I discovered that
the IL has it ("Family And Assembly"), but it seems that .Net languages such
VB.Net or C# don´t implement it, maybe because it was not considered useful
in most cases or maybe because it would be a problem to choose keywords for
"Protected INTERSECT Internal" and "Protected UNION Internal" accesibilty
levels. The current keyword pair "protected internal" means "Protected UNION
Internal" but it is not obvious, and when searching about this in Internet I
have seen early posts, even from MS people, that was confused thinking it
meant "Protected INTERSECT Internal"...
I hope this explains one of the scenarios where it would be nice to have
that accesibility level.
Carlos Quintero
"Eric Gunnerson [MS]" <er****@online.microsoft.com> escribió en el mensaje
news:ex**************@tk2msftngp13.phx.gbl...
Carlos,
Can you describe the scenario in which you'd like to use this?
--
Eric Gunnerson