C# internal VS VBNET Friend
Posted
by Will Marcouiller
on Stack Overflow
See other posts from Stack Overflow
or by Will Marcouiller
Published on 2010-05-07T18:11:12Z
Indexed on
2010/05/07
18:18 UTC
Read the original article
Hit count: 310
To this SO question: What is the C# equivalent of friend?, I would personally have answered "internal", just like Ja did among the answers! However, Jon Skeet says that there is no direct equivalence of VB Friend in C#. If Jon Skeet says so, I won't be the one telling otherwise! ;P
I'm wondering how can the keyword internal (C#) not be the equivalent of Friend (VBNET) when their respective definitions are:
The Friend (Visual Basic) keyword in the declaration statement specifies that the elements can be accessed from within the same assembly, but not from outside the assembly. [...]
Internal: Access is limited to the current assembly.
To my understanding, these definitions mean quite the same to me.
Then, respectively, when I'm coding in VB.NET, I use the Friend keyword to specify that a class or a property shall be accessible only within the assembly where it is declared. The same in C#, I use the internal keyword to specify the same.
Am I doing something or anything wrong from this perspective?
What are the refinements I don't get?
Might someone please explain how or in what Friend and internal are not direct equivalences?
Thanks in advance for any of your answers!
© Stack Overflow or respective owner