Possible Duplicate:
Why does C# not provide the C++ style ‘friend’ keyword?
I’d like the private member variables of a class to be accessible to a Tester class without exposing them to other classes.
In C++ I’d just declare the Tester class as a friend, how do I do this in C#? Can someone give me an example?
There’s no direct equivalent of ‘friend’ – the closest that’s available (and it isn’t very close) is InternalsVisibleTo. I’ve only ever used this attribute for testing – where it’s very handy!
Example: To be placed in
AssemblyInfo.cs