
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Why do we use internal keyword in C#?
Internal keyword allows you to set internal access specifier.
Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly.
Any member with internal access specifier can be accessed from any class or method defined within the application in which the member is defined.
Example
using System; namespace RectangleApplication { class Rectangle { internal double length; internal double width; double GetArea() { return length * width; } public void Display() { Console.WriteLine("Length: {0}", length); Console.WriteLine("Width: {0}", width); Console.WriteLine("Area: {0}", GetArea()); } } class Demo { static void Main(string[] args) { Rectangle rc = new Rectangle(); rc.length = 10.35; rc.width = 8.3; rc.Display(); Console.ReadLine(); } } }
- Related Articles
- Why do we use the params keyword in C#?
- Why do we use "use strict" in JavaScript?
- Why do we use random.seed() in Python?
- Why do we use interfaces in Java?
- Why do we use pandas in python?
- Why do we use brackets in BODMAS?
- Why do we Use JavaScript in HTML?
- Why do we use Convex Mirrors ?
- Why do we use JSON.stringify() method in jQuery?
- Why do we use DOCTYPES in HTML document?
- Why do we use modifiers in C/C++?
- Why do we use restrict qualifier in C++?
- Why do we use const qualifier in C++?
- Why do we use comma operator in C#?
- Why do we use salt in food preservation?

Advertisements