karthik
karthik

Reputation: 83

Converting an array from PHP to C#

I want to convert the below shown PHP array to a C# array.

I'm not sure how to do this.

Please help me to port this.

<?php
$var["figures"]["en"] = array(
    array(
        "table"    => "Revenue",
        "box"      => "Revenue",
        "axis"     => "Revenue",
        "legend"   => "Revenue",
        "link"     => "",
        "target"   => "",
        "footnote" => "",
        "unit"     => '',
        "stacked"  => '',
        "icon"     => ""
    ),
    array(
        "table"    => "PBIT",
        "box"      => "PBIT",
        "axis"     => "PBIT",
        "legend"   => "PBIT",
        "link"     => "",
        "target"   => "",
        "footnote" => "",
        "unit"     => '',
        "stacked"  => '',
        "icon"     => ""
    )
);
print_r($var);
?>

Upvotes: 0

Views: 2018

Answers (1)

Patrick Kostjens
Patrick Kostjens

Reputation: 5105

C# does not support array's with string indexes. A Dictionary is the closest you can get.

For a good example, have a look at this question.

Upvotes: 1

Related Questions