Skip to main content
 首页 » 编程设计

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

2024年02月24日15linjiqin

我得到了关于我的接口(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 行开始的缩进将成为字符串的一部分。