Вы находитесь на странице: 1из 2

3/18/2015

C#AccessModifiers,CSharpAccessSpecifiers

SiteMap|About

Netinformations.com

Home

C#

VB.NET

ASP.NET

AJAX

.NetFramework

C#AccessModifiers,C#Access
Specifiers

InterviewQuestions

About

Share

Access Modifiers (Access Specifiers) describes as the scope of


accessibility of an Object and its members. All C# types and type
membershaveanaccessibilitylevel.Wecancontrolthescopeofthe
memberobjectofaclassusingaccessspecifiers.Weareusingaccess
modifiers for providing security of our applications. When we specify
the accessibility of a type or member we have to declare it by using
anyoftheaccessmodifiersprovidedbyCSharplanguage.
C#providefiveaccessspecifiers,theyareasfollows:
public,private,protected,internalandprotectedinternal.
public:

public is the most common access specifier in C# . It can be access


fromanywhere,thatmeansthereisnorestrictiononaccessibility.The
scopeoftheaccessibilityisinsideclassaswellasoutside.Thetypeor
member can be accessed by any other code in the same assembly or
anotherassemblythatreferencesit.

AnoverviewofMicrosoftC#
C#LanguageTutorial
C#StatementsTutorial
C#GraphicalUserInterfaceTutorial

private:
Thescopeoftheaccessibilityislimitedonlyinsidetheclassesorstruct
in which they are declared. The private members cannot be accessed
outsidetheclassanditistheleastpermissiveaccesslevel.
protected:
The scope of accessibility is limited within the class or struct and the
classderived(Inherited)fromthisclass.
internal:
The internal access modifiers can access within the program that
containitsdeclarationsandalsoaccesswithinthesameassemblylevel
butnotfromanotherassembly.
protectedinternal:

C#CollectionTutorial

Protected internal is the same access levels of both protected and


internal.Itcanaccessanywhereinthesameassemblyandinthesame
classalsotheclassesinheritedfromthesameclass.

C#StringTutorial

Next:HowtoCultureInfoinC#

C#FileOperationsTutorial
C#ExcelTutorial
C#CrystalReportsTutorial
CSharpCommunicationTutorial

CSharpLanguageBasicsRelatedContents
C#Types
C#boxingandunboxing
http://csharp.netinformations.com/language/csharpaccessspecifiers.htm

C#Ado.NetTutorialandSourceCode,c#
databaseprogrammingtutorial
C#ADO.NETdataProvidersTutorial
C#DatasetTutorial
1/2

3/18/2015

C#AccessModifiers,CSharpAccessSpecifiers

C#DataTypes

C#DataAdapaterTutorial

C#typeconversions

CsharpDataViewTutorial

HowtoCultureInfoinC#

CsharpRemotingTutorial
C#XMLTutorial
C#DataGridViewTutorial

CSharpLanguageBasicsRelatedPrograms
C#OperatingSystemInformation
StartandKillProcessesinC#
RandomNumberGeneratorinC#

DSL - Sample Preparation


UK supplier of Herzog sample prep equipment for xrf,xrd,oes analysis

MoreSourceCode:

Search

Mailto:feedback@netinformations.com

netinformations.com(C)2015Foundedbyrapsmk
AllRightsReserved.Allothertrademarksarepropertyoftheirrespectiveowners.

http://csharp.netinformations.com/language/csharpaccessspecifiers.htm

2/2

Вам также может понравиться