Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
}<br />
}<br />
}<br />
Vals.Sort();<br />
showData(Vals);<br />
System.Console.ReadLine();<br />
Sample Run 3.8<br />
0 Smith,Fred<br />
1 Bell,Bert<br />
2 McDonald,Rory<br />
3 Mitchel,Brian<br />
4 Barr,Martin<br />
5 Kinlock,Graha<br />
0 Barr,Martin<br />
1 Bell,Bert<br />
2 Kinlock,Graha<br />
3 McDonald,Rory<br />
4 Mitchel,Brian<br />
5 Smith,Fred<br />
3.6 HashTables<br />
HashTables represents a collection of key‐and‐value pairs that are organized based<br />
on the hash code of the key. They are particularly useful for fast retrieval of data<br />
from a list. They are basically dictionaries of data. The main methods are:<br />
duction <strong>to</strong> .NET<br />
<strong>Intro</strong><br />
Add(object,object)<br />
Clear()<br />
Clone()<br />
Contains(object)<br />
ContainsValue(object)<br />
CopyTo(System.Array,int)<br />
GetEnumera<strong>to</strong>r()<br />
GetHash(object)<br />
Hashtable(int)<br />
Hashtable()<br />
KeyEquals(object,object)<br />
Remove(object)<br />
And the main properties are:<br />
Count<br />
Adds elements with a specified key and value in<strong>to</strong> the<br />
Hashtable.<br />
Removes the elements in Hashtable.<br />
Creates a shallow copy of the Hashtable.<br />
Determines whether the Hashtable contains a certain key.<br />
Determines whether the Hashtable contains a certain value.<br />
Copies a parts of a Hashtable <strong>to</strong> a one‐dimensional Array<br />
instance.<br />
Returns an enumera<strong>to</strong>r value that can iterate through the<br />
Hashtable.<br />
Returns the hash code for the specified key.<br />
Create a empty Hashtable.<br />
Creates an empty Hashtable.<br />
Compares an object with the key.<br />
Removes the element with the specified key from the<br />
Hashtable.<br />
Gets the number of key‐pairs in the HashTable.<br />
Agilent .NET Course: Arrays and Collections 17