What is index-based I/O for ArrayList collections in C#?

WBOY
Release: 2023-09-02 21:01:02
forward
646 people have browsed it

C# 中基于索引的 I/O ArrayList 集合是什么?

The ArrayList class represents an ordered collection of objects that can be individually indexed. It is an alternative to arrays.

The following table lists some common attributes of the ArrayList class:

Serial number Attributes and descriptions
1 Capacity

Gets or sets the number of elements that the ArrayList can contain.

2 Count

Get the number of elements actually contained in the ArrayList.

3 IsFixedSize

Gets a value indicating whether the ArrayList has a fixed size.

4 IsReadOnly

Gets a value indicating whether the ArrayList is read-only.

5 #Item

Gets or sets the element at the specified index.

The following is an example that shows how to use ArrayList in C# and find the capacity. The default capacity is 4.

Example

using System;
using System.Collections;

namespace Demo {
   class Program {
      static void Main(string[] args) {
         ArrayList x = new ArrayList();

         x.Add(45);
         x.Add(53);
         x.Add(12);
         x.Add(88);

         Console.WriteLine("Capacity: {0} ", x.Capacity);
      }
   }
}
Copy after login

The above is the detailed content of What is index-based I/O for ArrayList collections in C#?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!