我正在扩展 Exception 以在 Message 属性上实现一个 setter。这很好用。但不知何故:
CustomException.Message = "Test" + Environment.NewLine + "Test Again";
变成这样:
"Test\r\nTest Again"
我也试过这个,但没有运气:
CustomException.Message = @"Test
Test Again";
有什么想法吗?
最佳答案
Environment.NewLine
IS \r\n
(至少在 Windows 上,无论如何......)
关于c# - Exception.Message 中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1404557/