Internal access specifier exposes its member variables and member functions to other functions and objects in the current assembly. - CSharp Custom Type

CSharp examples for Custom Type:access level

Description

Internal access specifier exposes its member variables and member functions to other functions and objects in the current assembly.

Demo Code

using System;/*from w ww .  j a  va 2s. c  o m*/
class Rectangle {
   //member variables
   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 ExecuteRectangle {
   static void Main(string[] args) {
      Rectangle r = new Rectangle();
      r.length = 4.5;
      r.width = 3.5;
      r.Display();
      Console.ReadLine();
   }
}

Result


Related Tutorials