Where is the good old Friend statement?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In C++ there was the friend statement. What about something like it in C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.
 
Sharon said:
In C++ there was the friend statement. What about something like it in C#?
Is it the internal?

If it is the internal, I think it is too much and unsecured enough.

There is no equivalent of friend in C# currently, although there has
been talk about it (or something similar) appearing in .NET/C# 2.0.
Personally while I don't particularly hanker for friend access, I would
like to see namespace access (as Java has, although it's badly done
there - and Java doesn't have the equivalent of internal,
unfortunately).
 
The Friend statement is thankfully gone. A correctly designed architecture
doesn't need it. You should perhaps consider an interface.

For C# 2.0 Friend Assemblies will be available though. This will enable
access to the internal classes of an assembly. This is a change from the
current Internal access modifier that enables access to classes or members
in the same assembly which is possibly limiting for a component based
architecture relying on multiple assemblies.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Jon Skeet said:
There is no equivalent of friend in C# currently, although there has
been talk about it (or something similar) appearing in .NET/C# 2.0.

For clarities sake, the Friend Assemblies Bob mentioned is what is being
added. There is no explicit plans for any C++ like friend modifier that I am
aware of.
 
Back
Top