c# - 在 .NET 中用文本 block 初始化字符串的语法是什么?

标签 c# .net text

我正在编写单元测试,但不记得用一大块格式化文本初始化字符串的语法。

string _testData = "a couple screens worth of text data here
and I need to preserve the formatting
such as line breaks,
etc.";

最佳答案

在文字前添加一个@

string _testData = @"a couple screens worth of text data here
and I need to preserve the formatting
such as line breaks,
etc.";

关于c# - 在 .NET 中用文本 block 初始化字符串的语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/863572/

相关文章:

c# - Linq 使用 DataContext

.net - DataTable.Merge 和 DataTable.ImportRow 不会更改 RowState

asp.net - ApplicationClass Documents.Open 为 64 位系统上的 ASP.NET 站点返回 null

c# - 将 Double 变量转换为 Decimal

c# - Azure 功能身份验证 - 可以在没有 AD 的情况下吗?

c++ - 将基本文本添加到 Win32 应用程序,c++

C# ListView Label Edit - 控制选中的文本

text - Hadoop Mapreduce:TextInputFormat和处理行?

c# - 必需如果不在 MVC 5 中工作?

c# - 在这种情况下如何使用 Regex.Replace?