Explain Arrays in c#?
1) Is Statically strongly typed, fixed length data
2) You cant change length of array at runtime.
3) A single variable holds single data in c# but if you want to hold multiple values of the same type then array comes in picture.
4) A disadvantage of an array is fixed length and if access values beyond index and type this code at compile time it doesn’t give an error.
5) Also, you can access array element on an index basis.
6) An array can be Single-Dimensional, Multidimensional or Jagged.
7)The number of dimensions and the length of each dimension is established when the array instance is created. These values can’t change during the lifetime of the instance.
8)The default values of numeric array elements are set to zero, and reference elements are set to null.
9)A jagged array is an array of arrays, and therefore its elements are reference types and are initialized to null.
10)Arrays are zero indexed: an array with n elements is indexed from 0 to n-1.
11)Array elements can be of any type, including an array type.
12)Array types are reference types derived from the abstract base type Array. Since this type implements IEnumerable and IEnumerable, you can use foreach iteration on all arrays in C#.
2) You cant change length of array at runtime.
3) A single variable holds single data in c# but if you want to hold multiple values of the same type then array comes in picture.
4) A disadvantage of an array is fixed length and if access values beyond index and type this code at compile time it doesn’t give an error.
5) Also, you can access array element on an index basis.
6) An array can be Single-Dimensional, Multidimensional or Jagged.
7)The number of dimensions and the length of each dimension is established when the array instance is created. These values can’t change during the lifetime of the instance.
8)The default values of numeric array elements are set to zero, and reference elements are set to null.
9)A jagged array is an array of arrays, and therefore its elements are reference types and are initialized to null.
10)Arrays are zero indexed: an array with n elements is indexed from 0 to n-1.
11)Array elements can be of any type, including an array type.
12)Array types are reference types derived from the abstract base type Array. Since this type implements IEnumerable and IEnumerable, you can use foreach iteration on all arrays in C#.
Comments
Post a Comment