Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Does something similar to 'friend' exist in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Hart - 29 Jul 2005 10:46 GMT
Hi:

Is there an equivalent instruction to a 'friend' class in C++ available
under C#?

I have a class that I want, basically, readonly access to, except for
one class that would have total access to all its fields, public and
private.

TIA,
MartinH.
Oliver Sturm - 29 Jul 2005 11:09 GMT
> Is there an equivalent instruction to a 'friend' class in C++ available
> under C#?

Not in C# 1, but in C# 2 you can use the InternalsVisibleToAttribute to
do a similar thing, at least for some purposes. See the MSDN docs here:

 http://tinyurl.com/88s8e

               Oliver Sturm
Signature

omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog

Martin Hart - 29 Jul 2005 11:25 GMT
Oliver:

Very interesting, we are currently planning the migration to .NET 2,
this is just another argument to do so.

Thanks for your insight and sharing your knowledge.

Regards,
Martin.

Oliver Sturm escribió:

>> Is there an equivalent instruction to a 'friend' class in C++
>> available under C#?
[quoted text clipped - 5 lines]
>
>                Oliver Sturm
Lloyd Dupont - 29 Jul 2005 14:54 GMT
there is also another option 1.0 & + option
the 'internal' protection attributes make all your whatever accessible to
anything in the same assembly.

Signature

There are 10 kinds of people in this world. Those who understand binary and
those who don't.

> Hi:
>
[quoted text clipped - 6 lines]
> TIA,
> MartinH.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.