Friend

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

There is no such access modifier as "friend" in C#?

I've just looked through Framework SDK documentation and did not find it.
But there is one in VB.NET.
And there was one in classic C++.

Looks very strange.
What was the reason to implement it in VB.NET and not to implement in C#?

It is not something I can not live without, or can not complete my project.
I am just surprised.
 
Max said:
There is no such access modifier as "friend" in C#?
No.

I've just looked through Framework SDK documentation and did not find it.
But there is one in VB.NET.

Friend in VB.NET is equivalent to internal in C#, as far as I can see.
And there was one in classic C++.

Looks very strange.
What was the reason to implement it in VB.NET and not to implement in C#?

It's not the same in VB.NET as it is in C++ - effectively, it (the
VB.NET version) *is* implemented in C# as internal.
 
Hi Max,

As far as I remember, the C# equivalent for "Friend" is "internal".
 
"internal" is visible in the entire assembly




Dmitriy Lapshin said:
Hi Max,

As far as I remember, the C# equivalent for "Friend" is "internal".

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Max said:
There is no such access modifier as "friend" in C#?

I've just looked through Framework SDK documentation and did not find it.
But there is one in VB.NET.
And there was one in classic C++.

Looks very strange.
What was the reason to implement it in VB.NET and not to implement in C#?

It is not something I can not live without, or can not complete my project.
I am just surprised.
 
news.microsoft.com said:
"internal" is visible in the entire assembly

Yes, as is Friend in VB.NET:

<quote>
The Friend keyword confers friend access on one or more declared
programming elements. Friend elements are accessible from within the
program that contains their declaration and from anywhere else in the
same assembly.
</quote>

I'm not sure what they mean by "the program that contains their
declaration" admittedly...
 
Inline ****

Willy.

Max said:
There is no such access modifier as "friend" in C#?

I've just looked through Framework SDK documentation and did not find it.
But there is one in VB.NET.
And there was one in classic C++.

Looks very strange.
What was the reason to implement it in VB.NET and not to implement in C#?
**** VB.NET 'Friend' is the same as C# 'Internal'.
This feature is currently not available in .NET, .....
It is not something I can not live without, or can not complete my project.
I am just surprised.

**** But it is planned for the next release of .NET.
 
Willy Denoyette said:
**** But it is planned for the next release of .NET.

That's interesting - I'd heard it had got as far as being *considered*
- is it now definitely being planned? Any more information?
 
Hi,

Inline ****

Willy.

**** VB.NET 'Friend' is the same as C# 'Internal'.
This feature is currently not available in .NET, .....

**** But it is planned for the next release of .NET.
What you mean - This feature is currently not available in .NET?

Sunny
 
Sunny said:
What you mean - This feature is currently not available in .NET?

The equivalent of C++'s friend access is indeed unavailable in .NET at
the moment.
 
Jon,

Same here, but it's a feature requested by a number of C++ dev's, I guess MS wants to have this in the C++/CLI standard.

Willy.


Jon Skeet said:
Willy Denoyette said:
Look at Brad Abrams Blog [1] topic FriendAssemblies.

[1] http://blogs.gotdotnet.com/brada/

Thanks. That looks potentially quite interesting. It's something I hope
I'll never particularly need to use (as Jim Hogg writes, it's not
something to be done likely) but it's worth knowing about.
 
Back
Top