Array Operations

  • Chapter
  • First Online:
Essential ASP.NET Web Forms Development
  • 1290 Accesses

Abstract

An array is a container that holds data while it is being manipulated by a computer program. More specifically, it is a data structure that consists of a collection of elements of the same type, where each element contains its own value and is identified by one or more indices (a.k.a., subscripts). Arrays can be one-dimensional or multidimensional. The elements of a one-dimensional array are referenced by a single index, the elements of a two-dimensional array are referenced by two indices, and so on. It is not uncommon to see arrays of three or more dimensions. The total number of elements in an array is its length. Each dimension of an array has a lower bound (i.e., the index of the first element of the array) and an upper bound (i.e., the index of the last element of the array). Since arrays are zero based in C# by default, the index of the first element in a one-dimensional array is [0], the index of the second element is [1], and so on. The index of the first element in a two-dimensional array is [0, 0], the index of the second element is [0, 1], and so on. An array is statically allocated. That is, its capacity cannot be altered once it is declared. An array is considered an internal data structure because it resides in RAM and only remains there until the program that utilizes it terminates. Thus, the data in an array is said to be nonpersistent. This is in contrast to a database table, which is considered an external data structure because it resides on a peripheral device (e.g., a magnetic disk) and remains there even after the program that utilizes it terminates. Thus, the data in a database table is said to be persistent.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
EUR 29.95
Price includes VAT (France)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
EUR 62.99
Price includes VAT (France)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
EUR 79.11
Price includes VAT (France)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free ship** worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Arrays can even contain other arrays. These arrays are called jagged arrays. We will not consider jagged arrays in this book.

  2. 2.

    In C#, multidimensional arrays of up to 32 dimensions can be declared.

  3. 3.

    The Array class permits us to define different lower bounds if desired.

  4. 4.

    All property, method, and event descriptions were taken directly from Microsoft’s official documentation. The event handler methods used to handle the events of this class were omitted to conserve space. See the reference for all of the methods of this class.

  5. 5.

    Although sorting was mentioned in this list of array operations, the Array class does not contain a static Sort method for sorting two-dimensional arrays. If sorting such an array were required, we would have to write the code necessary to sort it.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Robert E. Beasley

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Beasley, R.E. (2020). Array Operations . In: Essential ASP.NET Web Forms Development. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5784-5_12

Download citation

Publish with us

Policies and ethics

Navigation