Who can access it if a method is marked as protected internal? - ProProfs Discuss
Advertisement

Who can access it if a method is marked as protected internal?

This question is part of C# Skills Test
Asked by Wyatt Williams, Last updated: Oct 27, 2020

+ Answer
Request
Question menu
Vote up Vote down

3 Answers

E. Stanley

E. Stanley

E. Stanley
E. Stanley, Technical writer, Indianapolis

Answered Jul 17, 2018

If the method is simply marked as protected it is only visible to the inheriting types. However, if it is marked as protected internal, it is visible to classes within the same assembly and classes derived from the declaring class. This means that all members in a specific class will be able to visualize the method.

Different settings provides users with the option of modulating which people can access the method. If you want to privatize the method, you can easily do so by changing the marking of the method. Different options will make it visible to only the select few personnel that you allowed.

upvote downvote
Reply 

aespoir

aespoir

aespoir
Aespoir

Answered Jan 08, 2017

Protected: Members are only visible to inheriting types.
Protected internal: Members are only visible to inheriting types and also to all types that are also contained within the same assembly as the declaring type.

upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Jan 08, 2017

Classes within the same assembly, and classes derived from the declaring class.
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.