📅  最后修改于: 2022-03-11 14:49:15.496000             🧑  作者: Mango
using System.Linq;
...
string source = "abc \t def\r\n789";
string result = string.Concat(source.Where(c => !char.IsWhiteSpace(c)));
Console.WriteLine(result);