C # methods of generic classes and collection classes

Source: Internet
Author: User

Integration & generic classes in FCL

List:

Arraylist uses an array that can be dynamically increased as needed to implement the ilist interface.
Bitarray: a compressed array of bit values. The value is a Boolean value. True indicates that the bit is open (1), and false indicates that the bit is closed (0 ).
Stack indicates a simple post-first-out non-generic set of objects.
Queue indicates the object's first-in-first-out set.
Queue <t> indicates the object's first-in-first-out set.
Stack <t> indicates the variable size of an instance of any type. It is a set of lifo.
Dictionary <t> indicates a set of keys and values.
Linkedlist <t> indicates a two-way linked list.
List <t> indicates the list of strong types of objects that can be accessed through indexes. Provides methods for searching, sorting, and operating the list.

Dictionary class:
Hashtable indicates the set of key/value pairs.Code.
Sortedlist indicates the set of key/value pairs. These key-value pairs are sorted by key and can be accessed by index.
Sorteddictionary <t, u> indicates the set of key/value pairs sorted by keys.
Sortedlist <t, u> indicates the set of key/value pairs. These key/value pairs are sorted by key based on the associated icomparer.

I. arraylist & list

Arraylist

The adapter creates an arraylist package for a specific ilist.
Add adds the object to the end of arraylist.
Addrange adds the icollection element to the end of arraylist.
Binarysearch is overloaded. Use split searchAlgorithmSearch for specific elements in the sorted arraylist or part of it.
Clear removes all elements from the arraylist.
Clone to create a superficial copy of The arraylist.
Contains determines whether an element is in the arraylist.
Copyto has been overloaded. Copy an arraylist or a part of it to a one-dimensional array.
Equals determines whether the specified object is equal to the current object. (Inherited from object .)
Indexof has been overloaded. Returns the index starting from scratch for the first matching item of a value in the arraylist or part of it.
Insert inserts an element into the specified index of arraylist.
Lastindexof is overloaded. Returns the index starting from scratch for the last matching item of a value in the arraylist or part of it.
Remove removes the first match of a specific object from the arraylist.
Removeat removes the element at the specified index of the arraylist.
Repeat returns the arraylist, whose element is a copy of the specified value.
Reverse is overloaded. Reverses the order of elements in an arraylist or a part of it.
Sort has been overloaded. Sorts the elements in an arraylist or a part of it.
The toarray has been overloaded. Copy the element of arraylist to the new array.

List

Add adds the object to the end of list <(of <(T>)>.
Addrange adds the elements of the specified set to the end of list <(of <(T>)>.
Binarysearch is overloaded. Search for specific elements in a sorted list (of) or a part of the list by using the score search algorithm.
Clear removes all elements from list <(of <(T>)>.
Contains determines whether an element is in list <(of <(T>)>.
Convertall <(of <(toutput>) converts the elements in the current list <(of <(T>)> to another type, return the list of converted elements.
Copyto has been overloaded. Copy list <(of <(T>)> or a part of it to an array.
Equals determines whether the specified object is equal to the current object. (Inherited from object .)
Find searches for elements that match the conditions defined by the specified predicate, and returns the First Matching Element in the entire list <(of <(T>)>.
Findall Retrieves all elements that match the conditions defined by the specified predicate.
Findindex has been overloaded. Searches for elements that match the conditions defined by the specified predicate and returns list <(of <(T>) or the index starting from scratch for the first matching item in a part of it.
Findlast searches for elements that match the conditions defined by the specified predicate, and returns the last Matching Element in the entire list <(of <(T>)>.
The findlastindex has been reloaded. Searches for elements that match the conditions defined by the specified predicate and returns list <(of <(T>) or the index starting from scratch for the last matching item in its part.
Foreach performs the specified operation on each element of list <(of <(T>)>.
GetType: Get the type of the current instance. (Inherited from object .)
Indexof has been overloaded. Returns the index starting from zero for the first matching item of a value in list <(of <(T>)> or a part of it.
Insert inserts an element into the specified index of list <(of <(T>)>.
Insertrange inserts an element in the set into the specified index of list <(of <(T>)>.
Lastindexof is overloaded. Returns the index starting from zero for the last matched item of a value in list <(of <(T>)> or a part of it.
Remove removes the first match of a specific object from list <(of <(T>)>.
Removeall removes all elements that match the conditions defined by the specified predicate.
Removeat removes the elements at the specified index of list <(of <(T>)>.
Reverse is overloaded. Returns the order of the elements in a list <(of <(T>)> or a part of the list.
Sort has been overloaded. Sorts the elements in a list <(of <(T>)> or a part of it.
Toarray copies the elements of list <(of <(T>)> to the new array.

Ii. hashtable & dictionary

Hashtable

Add adds the elements with the specified key and value to hashtable.
Clear removes all elements from hashtable.
Clone to create a superficial copy of hashtable.
Contains determines whether hashtable contains a specific key.
Containskey determines whether hashtable contains a specific key.
Containsvalue determines whether hashtable contains a specific value.
Copyto copies the hashtable element to the specified index location in the one-dimensional array instance.
Equals determines whether the specified object is equal to the current object. (Inherited from object .)
Gethash returns the hash code of the specified key.
Gethashcode is used as a hash function of a specific type. (Inherited from object .)
Remove removes elements with the specified key from hashtable.
Returns the string of the current object. (Inherited from object .)

Dictionary

Add adds the specified key and value to the dictionary.
Clear removes all keys and values from dictionary <(of <(tkey, tvalue>.
Containskey determines whether dictionary <(of <(tkey, tvalue>)> contains the specified key.
Containsvalue determines whether dictionary <(of <(tkey, tvalue>)> contains a specific value.
Equals determines whether the specified object is equal to the current object. (Inherited from object .)
Gethashcode is used as a hash function of a specific type. (Inherited from object .)
Remove removes the specified key value from dictionary <(of <(tkey, tvalue>)>.

 

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.