Help to Understand PHP Code into C#
<p>I am a C# guy and got this logic into php from a website. Need to implement the same in C#.</p>

<pre><code>$items = array();
while($row = mysql_fetch_assoc($query))
{
//parent id
$pkey = $row['parent_id'];
//child id
$ckey = $row['category_id'];
//store this
$items[$pkey]['children'][$ckey] = $row['categoryname'];
 }
//create our list
$first = true;
//create our list
createList($items, $first);

function createList($array, $first)
{
//we need access to the original array
global $items;
//first is a flag on whether or not this is the first item in the array
//we use this flag so that you don't need to initially call the function using createList($array[0]['children'])
if($first){
  $array = $array[0]['children'];
}
 echo "&lt;ol&gt;\n";
foreach($array as $key =&gt; $value){
  echo "&lt;li&gt;{$value}";
  //if this item does have children, display them
  if(isset($items[$key]['children'])){
    echo "\n";
    createList($items[$key]['children'], false); //set $first to false!
  }
  echo "&lt;/li&gt;\n";
}
echo "&lt;/ol&gt;\n";
</code></pre>

<p>} </p>

<p>In the above last line is it a 3 dimensional array or hashtable? it looks like its a hashtable cause [$pkey]['children'][$ckey] is bugging me..</p>

<p>Can anyone convert the above code in C#? I would really appreciate.</p>
