C # Collections

Source: Internet
Author: User

Collection:
ArrayList XXX = new ArrayList ();//Define a collection
Xxx.add//Add a program
Xxx. Insert (0, 16);//insert: Insert data than the original XXX "0" above the number of squeezing to XXX "1" on
Xxx. Insertrange (0,shuzu);//Insert an array at the specified location
Xxx. AddRange (Shuzu);//Append a set of elements at the last position
Xxx. Remove (16);//Remove only the first occurrence
Xxx. RemoveAt (3);//Remove the element at the specified index location
Xxx. Sort ();//ascending order
Xxx. Reverse ();//Invert collection
Console.WriteLine (Xxx[0]);//xxx[0] is added in the first number {1} is the second number and so on
Console.WriteLine (XXX. Count);//Returns the number of elements in the collection
Console.WriteLine (XXX. IndexOf (14));//Returns the index of the first occurrence only
Console.WriteLine (XXX. LastIndexOf (14));//Returns the index of the last occurrence

C # Collection

Related Article

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.