What are the access-specifiers available in c#?




Answers were Sorted based on User's Feedback



What are the access-specifiers available in c#?..

Answer / ranganathkini

The access-specifiers available in C# are:

1. public - The member can be accessed from anywhere
2. internal - The member can only be accessed from type it
originates from or other types in the same assembly
3. protected - The member can only be accessed from the type
it originates from or from detrieved types of the
originating type
4. protected internal - implies protected OR internal ( not
protected AND internal )
5. private - The member is only accessible by other members
within the type it originates from.

Is This Answer Correct ?    238 Yes 33 No

What are the access-specifiers available in c#?..

Answer / mrinalini

1.public
2.private
3.protected
4.internal
5.protected internal

Is This Answer Correct ?    130 Yes 21 No

What are the access-specifiers available in c#?..

Answer / anupam dixit

1. Public: Any member declared public can be accessed from
outside the class.

2. Private: it allows a class to hide its member variables
and member functions from other class objects and function.
Therefore, the private member of a class is not visible
outside a class. if a member is declared private, only the
functions of that class access the member.

3. Protected: This also allows a class to hide its member
var. and member func. from other class objects and
function, except the child class. it becomes important
while implementing inheritance.

4. Internal: Internal member can be expose to other
function and objects. it can be accessed from any class or
method defined within the application in which the member
is defined

5. Protected Internal: it's similar to Protected access
specifier, it also allows a class to hide its member
variables and member function to be accessed from other
class objects and function, excepts child class, within the
application. used while implementing inheritance.

Is This Answer Correct ?    126 Yes 23 No




What are the access-specifiers available in c#?..

Answer / vaibhav ichake

public
private
protected
interanl
protected internal

Is This Answer Correct ?    51 Yes 18 No

What are the access-specifiers available in c#?..

Answer / vijay

public,private,protected,internal,protectedinternal

Is This Answer Correct ?    53 Yes 22 No

What are the access-specifiers available in c#?..

Answer / shakira

Public,private,protected,internal,protected internal.

Is This Answer Correct ?    42 Yes 14 No

What are the access-specifiers available in c#?..

Answer / kishor niit ottapalam

An access specifier determines how other parts of a program
can access a class member.

Member access is controled by five access specifiers:

1. public,
2. private,
3. protected,
4. internal.
5. protected internal

1. public member can be accessed by any other code in
your program.
2. Main() is declared as public because it will be called
by code outside of its class (the operating system).
3. private member can be accessed only by other members
of its class.
4. A protected member is public within a class hierarchy,
but private outside that hierarchy.
5. A protected member is created by using the protected
access modifier.
6. The internal modifier declares that a member is known
throughout all files in an assembly, but unknown outside
that assembly.
7. The protected internal access level can be given only
to class members.
8. A member declared with protected internal access is
accessible within its own assembly or to derived types.

Is This Answer Correct ?    31 Yes 5 No

What are the access-specifiers available in c#?..

Answer / abhi

What is default accesssecifier for method in c#?

Is This Answer Correct ?    56 Yes 36 No

What are the access-specifiers available in c#?..

Answer / rashmi

1.public
2.private
3.protected
4.internal
5.protected internal

Is This Answer Correct ?    22 Yes 6 No

What are the access-specifiers available in c#?..

Answer / md eqbal ansari

C# provide five access specifiers , they are as follows :

public, private , protected , internal and protected
internal .

public :

public is the most common access specifier in C# . It can
be access from anywhere, that means there is no restriction
on accessibility. The scope of the accessibility is inside
class as well as outside. The type or member can be
accessed by any other code in the same assembly or another
assembly that references it.

private :

The scope of the accessibility is limited only inside the
classes or struct in which they are declared. The private
members cannot be accessed outside the class and it is the
least permissive access level.

protected :

The scope of accessibility is limited within the class or
struct and the class derived (Inherited )from this class.

internal :

The internal access modifiers can access within the program
that contain its declarations and also access within the
same assembly level but not from another assembly.

protected internal :

Protected Internal member can be accessed as a Internal
member within the assembly and as a protected member
outside the assembly.

Is This Answer Correct ?    18 Yes 5 No

Post New Answer



More C Sharp Interview Questions

Error handling and how this is done ?

2 Answers   Digital GlobalSoft,


2. What happened when BO object has been called?

0 Answers   Mphasis,


What is the difference between TypeOf and GetType?

3 Answers   Syntel,


can you overload a method of class A in Class B if it is derived class of A?If it is yes tell me how is it possible?

4 Answers   Ness Technologies, Mphasis,


Why we put script in head of asp.net page Why not in body?

1 Answers  






What are the ways to deploy an assembly?

1 Answers  


What are the Different kinds of methods?

4 Answers   Wipro,


For a combobox and a listbox same datatable given as a datasource. Now problem is that whenever focus of listbox changes selected value of combobox also get change or vice versa. what to be done to avoid this. According to requirement we cannot make different datasouce.

2 Answers   Syntel,


int i,string s, String s1 Which is valuetype which is refrence type.

6 Answers   Synechron, Sytel,


what are ways to debug the code step by step except using breakpoints?

1 Answers  


in a town the percentage of total men is 52. the percentage of total literacy is 48. if total percentage of literate men is 35 of total population. write a program to find out the total no of illiterate men and women.

3 Answers   HCL,


Assignment # 1 Print the pattern given below using single printf statement XX XX XX XX XX XX X X X X XX XX XX XX XX XX Assignment # 2 Print the pattern given below using single printf statement (please do NOT use the string function below) 0 909 89098 7890987 678909876 56789098765 4567890987654 345678909876543 23456789098765432 1234567890987654321

3 Answers   Wipro,






Categories