473,408 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Keyword 'friend' in C#?

Is there anything in C# correspondent to 'friend' keyword in C++?
I searched documents and found something [assembly:blahblah] but I am not
sure if it is what I am searching for.

Please reply. Thanks in advance.

Hyun-jik Bae
Sep 11 '06 #1
2 3385
The closest thing in C# is the "internal" access modifier. Basically,
this means that only other types in the same module can access it. For most
purposes, that means assembly (since there is usually only one module in an
assembly).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Hyun-jik Bae" <im***********@paran.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Is there anything in C# correspondent to 'friend' keyword in C++?
I searched documents and found something [assembly:blahblah] but I am not
sure if it is what I am searching for.

Please reply. Thanks in advance.

Hyun-jik Bae

Sep 11 '06 #2

Hyun-jik Bae wrote:
Is there anything in C# correspondent to 'friend' keyword in C++?
I searched documents and found something [assembly:blahblah] but I am not
sure if it is what I am searching for.

Please reply. Thanks in advance.

Hyun-jik Bae
C# 2.0 allows you to specify "friend" assemblies. Basically, this
allows you to expose internal types to another assembly. This is done
with the assembly attribute InternalsVisibleTo. So, to let assembly 2
access assembly 1's internal types, you would add:

[assembly:InternalsVisibleTo ("assembly2")]

to assembly 1.

HTH
--
Tom Shelton

Sep 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeff Grundy | last post by:
Is there any difference between these 3 ways of using the NEW keyword? Which is prefered? Dim xlApp As New Excel.Application Dim xlApp As Excel.Application = New Excel.Application Dim xlApp...
15
by: Samee Zahur | last post by:
Question: How do friend functions and static member functions differ in terms of functionality? I mean, neither necessarily needs an object of the class to be created before they are called and...
8
by: John Young | last post by:
Hi, I have a class (cGlobals.cs) which I create in my main form (frmMain). I have declared a variable at the top of my frmMain class (cGlobals gVars;). I then create an instance in my forms...
7
by: Steve | last post by:
I'm just curious, why did give VB.Net a Friend keyword but not C#?
3
by: Ben Galvin | last post by:
Hi, I'm looking for an equivalent to the C++ 'friend' keyword in C# (for those who don't know, this lets you give a specific class access to all the private/protected members of another class)....
3
by: Jean-Francois Hamelin | last post by:
Hi, Is there an equivalent to the C++ friend keyword in C#? Thanks JF
5
by: tuananh87vn | last post by:
hi, I'mm writing script for adding friend to a friend list.i'm using a form including friend_name (text), message (textarea) and below is my code: if(isset($_POST)) { ...
6
by: WaterWalk | last post by:
I find friend declaration just very tricky. I tried the following examples on both MingW(gcc 3.4.2) and VC++ 2005. The results are surprising. Example1: namespace ns1 { class Test { friend...
1
by: alamodgal | last post by:
hiiiiiii I have a problem in highlighting searching keyword.Actually im using this function for searching Public Function HighLight(ByVal Keyword As String, ByVal ContentFor As String) Dim...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.