C#以与我在php中相同的方式从数组中获取数据

SLI*_*SLI 2 c# arrays

怎样才能以相同的方式从数组中获取数据?

$arr = array(
    '123' => 'abc',
    '456' => 'def'
);
echo $arr['123']; // abc
Run Code Online (Sandbox Code Playgroud)

我如何在C#中使用数组?

Tim*_*ter 5

这看起来像一本字典:

Dictionary<int, string> dict = new Dictionary<int, string>
{
    {123, "abc"}, {456, "def"}
};
Console.WriteLine(dict[123]);  // abc
Run Code Online (Sandbox Code Playgroud)