C# Array

 

String arrays. We begin with string arrays. Square brackets are used for all arrays. The syntax is fairly simple, but we need to memorize it.

Note:All of these constructs are equivalent in the compiled code. Please choose the one you think is clearest.

Var:The var type is an implicitly-typed local variable. It is the same to the compiler as an explicit string array.

Tip:The fourth array allows us to test each value or insert logic as we assign it. This is sometimes useful.

Introduction

An array is group of  contiguous or related data items that share a common name. the individual are called element. it is a collection of fixed – size sequential collection of elements of the same type. it can be of any variable type.

ONE-DIMENSIONAL ARRAY

TWO-DIMENSIONAL ARRAY

A single list of item can given one variable or one subscript that variable  called one-dimensional array or single sub scripted  variable.

int[] vArray = {0,1,2,3};

An array represents multiple list of items variable such as table of items called two-dimensional array.

int[][] vArray = { {0,1,2,3}, {3,2,1,0}, {3,5,6,1}, {3,8,3,4} };

Leave a Reply

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