Creating and Using Arrays

This section describes arrays. An array is a data structure that can be used to store multiple values of the same type.

An array is a simple data structure with the following features:

The following is a list of commonly used terms related to the an array:

There are several syntaxes involved to define an array, create an array, assign an array, and represent an array elelement:

array_declaration_statement:
   type[] array_name;
array_creation_expression:
   new type[length]
array_assignment_statement:
   array_name = new type[length]
array_element expression:
   array_name[index]

The array declaration statement defines the name of the array, and the type of the data value the array can store. Once an array name is defined, it is ready to be assigned with an array of the same type.

The array creation expression creates an array of the specified type and length.

The array assignment statement assigns an array to an array name of the same type.

The array element expression represents an array element, which can be used in the same way as a variable of array's type.

Last update: 2010.

Table of Contents

 About This Book

 Introduction of C# (C Sharp)

 Data Type and Variables

 Logical Expressions and Conditional Statements

Arrays and Loop Statements

Creating and Using Arrays

 Creating and Using Arrays - Example

 "for" Loop Statements

 "while" Loop Statements

 Data Type Features

 Floating-Point Data Types

 Passing Parameters to Methods

 Execution Environment Class

 Visual C# 2010 Express Edition

 Class Features

 C# Compiler and Intermediate Language

 Compiling C# Source Code Files

 MSBuild - Microsoft Build Engine

 Memory Usages of Processes

 Multithreading in C#

 Async Feature from C# 5

 System.IO.FileInfo Class

 System.Diagnostics.FileVersionInfo Class

 WPF - Windows Presentation Foundation

 Partial Classes and Partial Methods

 Outdated Tutorials

 References

 PDF Printing Version