Access modifiers in .NET were designed with the idea that you can trust your co-workers to know how the code works and hence not slip up and introduce a bug.This idea is flawed though. Software development is so complicated that an experienced programmer knows not to even trust him/herself! For this reason, experienced programmers prefer to write code which, by design, cannot be broken through accidental misuse. .NET provides the tools to do this when only one class is involved, but the moment a programmer attempts to create a bullet-proof set of two or three interacting classes, this breaks down.The .NET-intended approach to this is to mark the shared members as "internal", which allows the classes to interact with each others' internals. Unfortunately this also allows _every other class in the assembly_ to mess with the internals, be it by accident or intentionally.SUGGESTION:Introduce a "nested" access modifier. When used on a member, this modifier allows access from any code contained in the outermost nested type. A top-level type (not nested in any other types) cannot have this modifier specified.Additionally, to allow several top-level types to have mutual access to each other's members, introduce a custom attribute, "NestedVisibleTo" or similar, which can be specified on a _type_ only, and specifies one or more types. All the listed types may then access this type's "nested"-modifier members, in addition to the usual ones, but not, for example, the "private" ones.Types nested one level deep should still be allowed to have this access modifier specified, because this would allow additional access when used in conjunction with "NestedVisibleTo".
Visual Studio/Silverlight/Tooling version
What category (if any) best represents this feedback?
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results