110,570
社区成员
发帖
与我相关
我的任务
分享
string source = "A B C 400 500 600 10 20 30";
Dictionary<string, string> replec = new Dictionary<string, string>();
replec.Add("A", "X");
replec.Add("B", "Y");
replec.Add("C", "Z");
/* 在这个位置写代码,使之控制台输出 X Y Z 100 200 300 1 2 3 */
foreach (string key in replec.Keys)
{
source = source.Replace(key, replec[key]);
}
Console.WriteLine(source);