Control on visibility in C#


Visibility control in C# is technique that allows to control visibility of a class,variable or method.with use of visibility control , you can restrict access of a class,variable or method and define their scope in C# programs.

Visibility Control


Like as another programming language C# also provide Visibility control.you can control visibility of method,variable and class.Various access modifier available in C# that allows you to control visibility of method,class variables,are follows:
public: Specifies that the variables or method are accessible both inside and outside the class in which they are defined.

Protected: Specifies that the variables and method are accessible,within the class in which they are defined and they also accessible within driven class of that class.

strong>private:Specifies that the variables ant method can only be accessed within the class in which they are defined.

internal:Specifies that the variables and method are visible within the current compilation unit.
static: this is a modifier,which is used to control the visibility of a method only.The static access modifier specifies that method is not part of an instance of a class.
extern is a access modifier,which is used only for method.The extern access modifier specifies that the method can be called by other class defined in other C# program


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: