• Have Any Question?
  • contact@eitworld.com

csharp.net data types





  • C#.Net is a rich language that is why every variable has a data type in it.
  • Data types assign the type of the value stored in a variable.
  • There are several data types are present in C#.Net which are used by the programmer at the time of creation of program.

In C#.Net data types are categorized into three parts which are given below:

  • Value Type
  • Reference Type
  • Pointer Type

data-types

Value Types

  • Value type data types are those data types which contains the actual data value.
  • These data types are of fixed length and stored on the stack of memory.
  • These data types are stored the copy of the value.
  • They are derived from the System.ValueType Class.

We can further classify the Value Types into two parts

  • User-Defined Types
  • Pre-Defined Types
User-Defined Types

User-Defined types are those value types which are defined by the users. There are two types of User-Defined types present in C# given below in the table:

data-types

Pre-Defined Types

Predefined Types are those value types which are already defined in C#. Following table contains all the Pre-Defined value data types of C#:

data-types

Reference Type

  • Reference Type data types are those data types which contains the reference of the value.
  • These data types are of varied length and stored on the heap in memory.
  • These data types do not contain copy of value like Value Type. On the other side these contain address of the value.

We can also classify Reference Type into two categories:

User-Defined Types

User-Defined Reference Types are those data types which are defined by the users. Following tables contains the User-Defined Reference Type present in C#:

data-types

Pre-Defined Types

Pre-Defined Reference Types are those data types which are already defined in C#. Following table tells us about the Pre-Defined Reference type present in C#:

data-types

Pointer Type

    • Pointer type data type is only used in the context of unsafe code.
    • Pointer Types variables are basically used to store the memory address of variable of any other data type.
    • We are giving here the syntax of pointer type data type:
datatype * identifier;


Real Time Web Analytics