Does something similar to 'friend' exist in C#

  • Thread starter Thread starter Martin Hart
  • Start date Start date
M

Martin Hart

Hi:

Is there an equivalent instruction to a 'friend' class in C++ available
under C#?

I have a class that I want, basically, readonly access to, except for
one class that would have total access to all its fields, public and
private.

TIA,
MartinH.
 
Martin said:
Is there an equivalent instruction to a 'friend' class in C++ available
under C#?

Not in C# 1, but in C# 2 you can use the InternalsVisibleToAttribute to
do a similar thing, at least for some purposes. See the MSDN docs here:

http://tinyurl.com/88s8e



Oliver Sturm
 
Oliver:

Very interesting, we are currently planning the migration to .NET 2,
this is just another argument to do so.

Thanks for your insight and sharing your knowledge.

Regards,
Martin.

Oliver Sturm escribió:
 
there is also another option 1.0 & + option
the 'internal' protection attributes make all your whatever accessible to
anything in the same assembly.
 
Back
Top