Thursday, 15 October 2015

What is Array and Type of Array in C#

What is array?
Array is a type that holds multiple variables of one type, allowing index access to the individual value. 

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

An array in .NET is created from Array base class. Array is a reference type because it is created from array class. The base class for arrays in C# is the System.Array class.

Array is fixed type. You can create array of primitive and non-primitive types. Array base address is stored in stack and array is kept in heap memory.
System.Array is the abstract base type of all array types. Array type can't be inherited. Array can't be extended. There size is fixed. Private constructor and inner class is use to create it

Type of Arrays in C#
  • Single-dimensional arrays 
  • Multidimensional arrays (rectangular arrays) 
  • Jagged Arrays (array-of-arrays) 

No comments:

Post a Comment