Please help me re-write this code sample in PHP to C#:
$stringArray = array();
$stringArray['field1'] = 'value1';
$stringArray['field2'] = 'value2';
$stringArray['field3'] = 'value3';
foreach ($stringArray as $key => $value)
{
echo $key . ': ' . $value;
echo "\r\n";
}
Named arrays do not exist in C#. An alternative is to use a
Dictionary<string, string>to recreate a similar structure.In order to iterate through them, you can use the following: