Basic Overview of C #

This article describes an introduction of C# programming language.

c#, c-sharp, #

What is C#?
C# (pronounced C-sharp) is a one kind of objects oriented language developed by Microsoft Corporation. It is designed with the combination of C and C++. It has taken a lot of concepts from Java.

Data Types in C#
In a programming language Data Types describes what type of data a variable can hold. C# is a strongly typed language. That means every variable and object must have a declared type. When we declare a variable, we have to tell the compiler about what type of the data the variable can hold. In C# programming language, Data types are divided into three categories:

  • Value Type
  • Reference Type
  • Pointer Type

Value Type
A Value Type variable stores a copy of the value in the memory. Some common examples are int, char, float. When we declare an int type, the system allocates memory to store the value.
Example of Built-In Value Types                   : int, char, float, long, double, byte, bool etc
Example of User-Defined Value Types         : struct, enumerations/enum

Reference Type
A Reference Type stores the address of the value in the memory. It does not contain the actual data stored in a variable. They contain a reference to the variables.
Example of Built-In Reference Types           : object, dynamic, string
Example of User-Defined Reference Types : class, interface, delegate, Array, HashTable

Pointer Type
Pointer type variables store the memory address of another type. Pointers in C# have the same capabilities as in C or C++.
Example: char* cptr, int* iptr

What is Boxing and Unboxing?
In C# it is possible to convert a value of one type to a value of another type. The operation or process of Converting a Value Type to a Reference Type is called Boxing and the operation or process of converting a Reference Type to a Value Type is called Unboxing.

Comments

  1. By Tonmoy

    Reply

Leave a Reply

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