Two-dimensional arrays, collections

Source: Internet
Author: User

Collection: Define a collection, set Stone a class, in the System.Collections library, you need an index
ArrayList al = new ArrayList (); The collection is indexed as an array, and the index starts at 0 and adds the meaning of an int value.
int i= al. Add (3);//print out an int value returned by index 0, which is the index of the added data in the collection
int a= al. ADD (5);
int b= al. ADD (7);
Al. Insert (1,9);//Inserts an index of 1 inserts a 9 at 1 on this index, insert data 9. The data of the original position is indexed in turn by one
Al. Remove (7);//Reject data If there are two identical values remove the first one
Al. RemoveAt (1);//Remove Index
int cc = al. The number of count;//collection lengths
Console.Write (al[0]);//Read index
Console.Write (al[1]);
Console.Write (al[2]);
Console.Write (Al[3]);

Console.Write (i + "+ A +" "+ b);//There is only one entrance at the end,
Console.WriteLine (CC);
Console.ReadLine ();

The number of people with each person's score is stored in the collection and the loop reads

Two-dimensional arrays, collections

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.