用逗号分隔的连接字典键

Abd*_*Haj 3 c# string dictionary concatenation comma

我正在寻找一种更好的方法来连接字典键,这就是我现在正在做的事情:

Dictionary<int, string> myList = new Dictionary<int, string>();

myList.Add(1, "value");
myList.Add(2, "value");
myList.Add(3, "value");
myList.Add(4, "value");

string choices = "";

foreach (int key in myList.Keys)
{
    choices += key + " ";
}

choices = "(" + choices.Trim().Replace(" ", ",") + ")"; // (1,2,3,4)
Run Code Online (Sandbox Code Playgroud)

我确定有更好的方法,LINQ可能吗?

Tim*_*ter 20

string.Format("({0})", string.Join(",", myList.Keys));
Run Code Online (Sandbox Code Playgroud)