A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
14
Task/Hash-from-two-arrays/C-sharp/hash-from-two-arrays-1.cs
Normal file
14
Task/Hash-from-two-arrays/C-sharp/hash-from-two-arrays-1.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
System.Collections.HashTable h = new System.Collections.HashTable();
|
||||
|
||||
string[] arg_keys = {"foo","bar","val"};
|
||||
string[] arg_values = {"little", "miss", "muffet"};
|
||||
|
||||
//Some basic error checking
|
||||
int arg_length = 0;
|
||||
if ( arg_keys.Length == arg_values.Length ) {
|
||||
arg_length = arg_keys.Length;
|
||||
}
|
||||
|
||||
for( int i = 0; i < arg_length; i++ ){
|
||||
h.add( arg_keys[i], arg_values[i] );
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
for( int i = 0; i < arg_length; i++ ){
|
||||
h[ arg_keys[i] ] = arg_values[i];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue