473,396 Members | 1,859 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,396 software developers and data experts.

Equivalent of the C++ "friend" class modifier

Is there such a thing in C#?

I know of the
internal
class modifier, but I want to grant "friend"-like access to a
particular class from a different assembly. The reasons why I need
this are long an involved, and the company I work for won't budge on
the issue, so I need to find a way to make this work.

Any ideas?

Thanks.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #1
3 8845
"internal" is similar to "friend", only difference is that internal can't
specify which classes have access, like friend can.
"Quimbly" wrote:
Is there such a thing in C#?

I know of the
internal
class modifier, but I want to grant "friend"-like access to a
particular class from a different assembly. The reasons why I need
this are long an involved, and the company I work for won't budge on
the issue, so I need to find a way to make this work.

Any ideas?

Thanks.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #2
Not according to this :
http://msdn.microsoft.com/library/de...tskeywords.asp

One thing you could do, if you have access to both assemblies, is to create
a public class in the one you need access TO, and then use that as a
doorway. That would of course mean that everybody can get access to the
internal class, but if the company won't budge you don't have many options
that I can see.

Steve

"Quimbly" <fr******************@yahoo-dot-com.no-spam.invalid> wrote in
message news:42********@127.0.0.1...
Is there such a thing in C#?

I know of the
internal
class modifier, but I want to grant "friend"-like access to a
particular class from a different assembly. The reasons why I need
this are long an involved, and the company I work for won't budge on
the issue, so I need to find a way to make this work.

Any ideas?

Thanks.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #3
> this are long an involved, and the company I work for won't budge on
the issue, so I need to find a way to make this work.


They'd better get over it, because with reflection in trusted code the
access modifiers don't mean jack.
Nov 16 '05 #4

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

Similar topics

2
by: Shea Martin | last post by:
I am trying to use a system call which takes a function ptr. My compiler won't compile the code if I give the system_call a ptr to a class member function, A::func(). To combat this, I created an...
0
by: zealotcat | last post by:
Code from book <<C++ templates>> ---------------------------------------------------- template<typename T> class C { .... friend void f(); friend void f(C<T> const&); .... };
43
by: Zeng | last post by:
It's so messy w/o the "friend" relationship. Does anyone know why it was not supported in C#. It's almost about as bad as it doesn't support the inheritance hierarchy and method reference...
1
by: timbobd | last post by:
I have encountered a situation that I don't understand. When I call a sub of Friend scope (in an object with Friend scope), I am getting an error "Public member 'subname' not found in type...
2
by: Vark | last post by:
Interesting behavior I came across today where a child form has full access to a base form class' controls, but you can only modify the controls' properties in code, not in the visual designer....
0
by: AndyB | last post by:
I'm using xsd.exe to generate a typed-dataset. Then using typed dataset tables (datatables containing two columns--a name and a value) to bind to ASP.NET dropdown list controls (for the dropdown...
3
by: jbeteta | last post by:
Hello, I have a problem declaring variables. I need to create an object oRpte as ReportClass on WebForm1.aspx and be able to use its value on WebForm2.aspx. For declaring the property oRpte()...
4
by: Yarco | last post by:
In c++ we could modify the private variable in a class use friend keyword. How could it be done in php? class YourBag { int money; friend class Thief; // friend? };
3
by: shybe | last post by:
Ok, Im trying to create a "send this article to a friend" script for my blog, Right now its sending all the articles, but I want it to only send the article in which the form is attached...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.