c# - 如何处理接口(interface)函数的长描述行

标签 c# function

我得到了关于我的接口(interface)函数的详细描述。

IMyInterface.cs

[Description("Line 1 description content here! Line 2 description content here!Line 3  description content here!Line 4 description content here!Line 5 description content here!Line 6 description content here!")]
void foo()
{
}

如何将单线样式转换为多线样式。谢谢。

[Description("Line 1 description content here! 
 Line 2 description content here!Line 3 description content here!
 Line 4 description content here!Line 5 description content here!
 Line 6 description content here!")]
void foo()
{
}

最佳答案

您想使用逐字字符串,只需在您的字符串前加上@:

[Description(@"Line 1 description content here!  
 Line 2 description content here!
 Line 3 description content here! 
 Line 4 description content here!
 Line 5 description content here! 
 Line 6 description content here!")] 
void foo() 
{ 
} 

请注意,在这种情况下,从第 2 行开始的缩进将成为字符串的一部分。

关于c# - 如何处理接口(interface)函数的长描述行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2196824/

相关文章:

bash - 为什么 bash 脚本中需要 "declare -f"和 "declare -a"?

c# - 如何将原始 HTTP 响应解析为 HttpListenerResponse?

c# - 静态方法与实例方法,多线程,性能

c# - 如何从最近的点找到路径上的点?

c - 如何从函数返回两个值?

mysql - 执行咨询时出错 (1242) : Subquery returns more than 1 row

c# - 无法使用 IP 地址连接到应用程序

c# - try catch的用法

python - 有没有办法让 Python 函数重复参数集?

javascript - 输入框功能不起作用