Access Modifier

public

The type or member can be accessed by any other code in the same assembly or another assembly that references it.

If you can see the class, then you can see the method

private

The type or member can only be accessed by code in the same class or struct.

If you are part of the class, then you can see the method, otherwise not.

protected

The type or member can only be accessed by code in the same class or struct, or in a derived class.

Same as Private, plus all descendants can also see the method.

internal

The type or member can be accessed by any code in the same assembly, but not from another assembly.

protected internal

The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.

Share the joy
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.