Tuesday, 15 June 2010

PHP array Conversion to C# -



PHP array Conversion to C# -

i wondering how can convert php code c#:

array("id" => $intid, "clients" => array(), "max" => $max, "requests" => 0);

in c# have this:

string[,] waddleobject = new string[,] { { "id", id.tostring() }, { "clients", new string[] { } }, { "max", max.tostring() }, { "requests", "0" } };

that c# doesn't work, ideas can here?

you can utilize dictionary available in c# this.

dictionary<string,list<string>> waddleobject = new dictionary<string,list<string>>(); var item = new list<string>.add(id.tostring(); waddleobject.add("id",item);

the reason can find key in o(1). this

list<string> val = waddleobject["id"];

c# php

No comments:

Post a Comment