Convert PHP to C# - how to handle arrays?
<p>I need to convert a few lines of PHP code to C#. However, I have only basic knowledge and I don't understand well the arrays yet. </p>

<p>Here is the code that I need to be converted to C#:</p>

<pre><code>function decode_char($c, $a1, $a2)
{
  $result = $c;
  for($j = 0; $j &lt; count($a1); $j++) {
    if ($c == $a1[$j][0]) {
      $result = $a2[$j][0];
      break;
    }
    if ($c == $a2[$j][0]) {
      $result = $a1[$j][0];
      break;
    }
  }
  return $result;
}

function decode_str($s)
{
  $a1 = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "W", "G", "X", "M", "H", "R", "U", "Z", "I", "D", "=", "N", "Q", "V", "B", "L");
  $a2 = array("b", "z", "a", "c", "l", "m", "e", "p", "s", "J", "x", "d", "f", "t", "i", "o", "Y", "k", "n", "g", "r", "y", "T", "w", "u", "v");

  $result = '';
  for($i = 0; $i &lt; strlen($s); $i++) {
    $result .= decode_char($s[$i], $a1, $a2);
  }
  $result = base64_decode($result);
  return $result;
}
</code></pre>

<p>Here's what I've got so far:</p>

<pre><code>public string decode_str(string s)
{
       string[] a1 = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "W", "G", "X", "M", "H", "R", "U", "Z", "I", "D", "=", "N", "Q", "V", "B", "L" };
       string[] a2 = { "b", "z", "a", "c", "l", "m", "e", "p", "s", "J", "x", "d", "f", "t", "i", "o", "Y", "k", "n", "g", "r", "y", "T", "w", "u", "v" };

       string result = "";
       for (int i = 0; i &lt; s.Length; i++)
       {
           result += decode_char(s[i], a1, a2);
       }

           return result;
}
</code></pre>

<p>Can someone help with converting <code>decode_char</code>?</p>

<p><strong>Thank you for fast answers. I already did it myself but using strings and not chars, so I will accept an answer tomorrow when I will revise my code</strong>.</p>
