473,763 Members | 7,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Modifiers

Hello

Can anyone provide advice/links on somewhere to get a definitive explanation with Examples of how "protected internal" differs from "protected" , "internal" and the other access modifiers

For "protected internal" some places appear to say it means a union of protected AND internal, other places say it's protected OR internal

Thanks

Pet

Nov 15 '05 #1
3 3083
Both the C# Reference and the C# Specification state OR.
The following is an excerpt from the Common Type System, which defines the
rules the IL/Metadata must abide by under the managed environment:

The accessibility domain of a nested member M declared in a type T within a
program P is defined as follows (noting that M might itself be a type):
a.. If the declared accessibility of M is protected internal, the
accessibility domain of M is the intersection of the accessibility domain of
T with the program text of P and the program text of any type derived from T
declared outside P.
-Rob Teixeira [MVP]

"Pete" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.com...
Hello,

Can anyone provide advice/links on somewhere to get a definitive explanation with Examples of how "protected internal" differs from
"protected" , "internal" and the other access modifiers.
For "protected internal" some places appear to say it means a union of protected AND internal, other places say it's protected OR internal.
Thanks,

Pete

Nov 15 '05 #2
It's an OR.

From:
http://msdn.microsoft.com/library/de...spec_3_5_1.asp

The MSDN C# Reference.

-----------------

a.. Protected internal (meaning protected or internal), which is selected by
including both a protected and an internal modifier in the member
declaration. The intuitive meaning of protected internal is "access limited
to this program or types derived from the containing class".
-----------------
Also, From the C# Programmers Reference;

"protected internal
[...] Access is limited to the current assembly or types derived from
the containing class."
"Only one access modifier is allowed for a member or type, except for the
protected internal combination."

Hope it helps;

Josh

Microsoft.com Tools

"Pete" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.com...
Hello,

Can anyone provide advice/links on somewhere to get a definitive explanation with Examples of how "protected internal" differs from
"protected" , "internal" and the other access modifiers.
For "protected internal" some places appear to say it means a union of protected AND internal, other places say it's protected OR internal.
Thanks,

Pete

Nov 15 '05 #3
For the benefit of us muggles/mortals:
protected internal is a union of protected and internal in terms of
providing access but not restricting.
Meaning
Inherited types, even though they belong to a different assembly, have
access to the protected internal members
Types that reside in the same assembly, even if they are not derived from
the type, also have access to the protected internal members
Sankar Nemani

"Rob Teixeira [MVP]" <RobTeixeira@@m sn.com> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
Both the C# Reference and the C# Specification state OR.
The following is an excerpt from the Common Type System, which defines the
rules the IL/Metadata must abide by under the managed environment:

The accessibility domain of a nested member M declared in a type T within a program P is defined as follows (noting that M might itself be a type):
a.. If the declared accessibility of M is protected internal, the
accessibility domain of M is the intersection of the accessibility domain of T with the program text of P and the program text of any type derived from T declared outside P.
-Rob Teixeira [MVP]

"Pete" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ***********@mic rosoft.com...
Hello,

Can anyone provide advice/links on somewhere to get a definitive

explanation with Examples of how "protected internal" differs from
"protected" , "internal" and the other access modifiers.

For "protected internal" some places appear to say it means a union of

protected AND internal, other places say it's protected OR internal.

Thanks,

Pete


Nov 15 '05 #4

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

Similar topics

3
1750
by: kchalla | last post by:
Can anybody let me know the difference between public and private class access modifiers? Thanks in advance
3
1412
by: Ben R. Bolton | last post by:
Is it possible to define a property such that the get accessor is public and the set accessor is private? Ben
2
2743
by: Bob Weiner | last post by:
Is it possible to create a property and specify different access modifiers for the get and set methods? From the property definition it appears that you can define attributes but not access modifiers. I have never used attributes so I don't know if they are useful for this purpose. What I want to do is to create an 'Entry' class that will be used by two other classes. One class will create the 'Entry', assign limits, a default value...
4
3213
by: Picho | last post by:
Hi all, Using reflection, I can invoke/call private methods of an object. is this intended? if yes, why? in what scenario (example would be good) should I be givven the option to use something that was declared private (not public) and not mine to use? seems to me this is somewhat malicious... if not.... well....
1
1220
by: Frank | last post by:
I have a form implemented as shown below. If I define the tp_ data member as private it is always null in the Click event handler. When I remove private and let it use the default access ( which I think is private ) then it is ok ( non null ) in the Click handler. I don't understand why? public partial class Properties_Form_TiePoint : Form { // this declaration works ok Tiepoint tp_ = new Tiepoint();
3
2468
by: RitualDave | last post by:
This compiles and runs successfully in VS2005: ref class A { private: ~A() { this->!A(); } // private! !A() { } // private! }; ....
2
1327
by: Roy | last post by:
If I define a property as int age { get; set; } Is there a way to add different access modifiers to the accessors when implement?
6
2078
by: Michael Bray | last post by:
I've just inherited a fairly large project with multiple classes. The developer also wrote a huge number of unit tests (using NUnit) to validate that the classes work correctly. However, I don't think that the class itself should include unit tests, especially since it has to reference nunit.framework in order to compile/work, and I don't want to have to distribute the nunit.framework.dll with this class. So I created a new project,...
2
1612
by: arunbalait | last post by:
Actually I dont know where to post this question..... Actually this is a OOPS concept...... I want to know what are access modifiers and access specifiers? What are the differences between them? Thanx.....
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.