C # ArrayList, Generics, method overloads, overrides, and so on

Source: Internet
Author: User

1, why to use ArrayList:

2. Virtual method and rewrite method

3. Let the method not be rewritten

4. External methods

Introducing namespaces shortcut keys: Ctrl + ALT +F10

5. Overloading of methods

  

Example:

6. Destructors, releasing resources

7. The difference and relationship between generics and ArrayList

ArrayList or arrays Yes, he and the two generic sets of the difference is that he belongs to the weak type collection and the generic collection is a strongly typed collection, the understanding of people may already know what I mean, that is, the type of ArrayList is object, although convenient, but may also cause hidden trouble, For example, a type error occurs when a value is stored in a different type, and a generic collection is defined as the type of the,list<, which defines the types you expect to deposit, which limits the type of List access and the likelihood of errors that can be avoided greatly. This is also the advantage of a strongly-typed collection, and from the namespace of your new class, Microsoft has already introduced the System.Collection.Generic to you by default, which means that Microsoft also wants us to use generic collections a lot.

C # ArrayList, Generics, method overloads, overrides, and so on

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.