Last active
September 21, 2015 16:13
-
-
Save ChrisMoney/79f0a3d2d7dc795a3243 to your computer and use it in GitHub Desktop.
Hash - C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
class Program | |
{ | |
static Hashtable GetHashtable() | |
{ | |
Hashtable hashtable = new Hashtable(); | |
hashtable.Add(300, "Carrot"); | |
hashtable.Add("Area", 1000); | |
return hashtable; | |
} | |
static void Main() | |
{ | |
Hashtable hashtable = GetHashtable(); | |
string value1 = (string)hashtable[300]; | |
Console.WriteLine(value1); | |
int value2 = (int)hashtable["Area"]; | |
Console.WriteLine(value2); | |
} | |
} | |
//Output | |
Carrot | |
1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment