怎样才能以相同的方式从数组中获取数据?
$arr = array(
'123' => 'abc',
'456' => 'def'
);
echo $arr['123']; // abc
Run Code Online (Sandbox Code Playgroud)
我如何在C#中使用数组?
这看起来像一本字典:
Dictionary<int, string> dict = new Dictionary<int, string>
{
{123, "abc"}, {456, "def"}
};
Console.WriteLine(dict[123]); // abc
Run Code Online (Sandbox Code Playgroud)