RosettaCodeData/Task/Hash-from-two-arrays/C-sharp/hash-from-two-arrays-1.cs
2023-07-01 13:44:08 -04:00

17 lines
454 B
C#

static class Program
{
static void Main()
{
System.Collections.Hashtable h = new System.Collections.Hashtable();
string[] keys = { "foo", "bar", "val" };
string[] values = { "little", "miss", "muffet" };
System.Diagnostics.Trace.Assert(keys.Length == values.Length, "Arrays are not same length.");
for (int i = 0; i < keys.Length; i++)
{
h.Add(keys[i], values[i]);
}
}
}