1.53. C# collection

发布时间 :2023-10-12 23:00:07 UTC      

The Collection class is a class dedicated to data storage and retrieval. These classes provide support for stack, queue, list, and hash table. Most collection classes implement the same interface.

The Collection class serves different purposes, such as dynamically allocating memory for elements, accessing list items based on indexes, and so on. These classes create a collection of objects of the Object class. In C#, the Object class is the base class for all data types.

1.53.1. Various collection classes and their usage #

Here are a variety of commonly used System.Collection class of the namespace. Click the link below to see the details.

Class

Description and usage

ArrayList

It represents an ordered collection of objects that can be indexed separately. It can basically replace an array. However, unlike an array, youcan use the index to add and remove items at a specified location, and the dynamic array automatically resizes it. It also allows dynamic memory allocation, adding, searching, and sorting items in the list.

Hash table

It uses keys to access elements in the collection. When you use keys to access elements, a hash table is used, and you can identify a useful key value. Each item in the hash table has a key/value pair. Key is used to access items in the collection.

SortedList

It can use keys and indexes to access items in the list. A sorted list is a combination of arrays and hash tables. It contains a list of items that can be accessed using keys or indexes. If you use an index to access items, it is a dynamic arrayList, and if you use keys to access items, it is aHashtable. Items in the collection are always sorted by key value.

Stack

It represents a collection of last-in, first-out objects. Use the stack whenyou need last-in-first-out access to items. When you add an item to the list called a push element, when you remove an item from the list, it is called a pop-up element.

Queue

It represents a collection of first-in, first-out objects. Queues are used when you need first-in, first-out access to items. When you add an item to the list, it is called queuing, and when you remove an item from the list, it is called queuing.

BitArray

It represents a binary array represented by values 1 and 0. Use a point array when you need to store bits but do not know the number of bits in advance. You can access items from the dot array collection using an integerindex, starting from scratch.

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.