As in the title, I would love to see this in C#.
namespace PrivateStuff; //note: filescope namespace here!
public class PartiallyVisibleOutside
{
public int A;
namespace int B;
}
public class Test
{
public PartiallyVisibleOutside NC {get; private set;}
public void DoSmth()
{
NC.A = 100000 + NC.B; //OKAY til now!
Console.Write(NC.A);
}
}
//
namespace OUTSIDE;
public class OutsideClass
{
public PartiallyVisibleOutside Test;
void DoSmth()
{
Test.A = 100; //OKAY
Test.B = 100; //Compiletime-Error!
}
}
Does smth like this exist? Or shall i open up a feature-request at C#
There is no such feature and I think it is very niche thing to be implemented in near feature. Though you can simulate it by moving
TestandPartiallyVisibleOutsideinto separate project (assembly) and markingBasinternal.