More encapsulation abilities

Topics: C# Language Design
Jun 4, 2014 at 2:29 PM
We often write class A then write unit tests for it then some editor class AEditor...
I do not want to open access if A internals to everyone but for AEditor and AUnitTests I want.

So adding some sort of C++ friend to C# will be solution.

I can write:
class A
{
   private friend AEditor;
}
and AEditor than can access private A members;

If AEditor is in separate assembly and AEditor assembly depends on A assembly then we need extended version of [InternalsVisibleToAttribute] that can be placed on class and can specify class name inside another dll. Also it must be cut in release assembly version.

What encapsulation abilities language needs you think?
Jun 5, 2014 at 9:43 PM
If you want a builder class to be able to access the internals of the class it's building, write it as a nested class.
Jun 6, 2014 at 11:47 AM
It is not possible if builder must lie in separate assembly