Learn the Basics about C# Data Types

  • Learn the Basics about C# Data Types

Learn the Basics about C# Data Types

Introduction:

Data types  are used everywhere in a programming  language like C,C++,Java,C# . In C# you cannot use variable without data types .Data types tell the compiler that  which type of data is used for processing .

For example if you want to work with string value then you will have to assign string type variable to work with. In this article we will discuss some of the most used data types and how they work.

 Data Types:

The  type of data that a variable contains is called data types .C# is a strongly typed language so every variable and object contain data type .C# provides two types of data type.

  • Value Type
  • Reference Type

Value Type:

Value type is one of the most commonly used data type in C# .Value type variables can be assigned a value directly.A value type data type stores copy of the value. The value types directly contain data. Some examples are ,

  • Byte
  • Short
  • Int
  • Float
  • Double
  • long
  • char
  • bool
  • DateTime

 Exclusive offer for Dot Net Training in chennai

Reference Type :

The reference types do not contain the actual data stored in a variable, but they contain a reference to the variables. Reference type contains a pointer to memory location that holds the data.

Examples of reference types are,

  • Classes
  • Objects
  • Arrays
  • Indexers
  • Interfaces