[英]Stylecop SA1001 warning
why does the following code give me a SA1001 warning? 为什么以下代码给我SA1001警告?
Class test = new Test
{
Test1 = "1"
, Test2 = "2"
, Test3 = "3"
};
I've checked documentation which says that to avoid this warning my commas should not be preceeded by a space unless they're the first thing on a line, and should have a space after them unless they're the last thing on the line, but this isn't getting rid of the warning. 我已经检查过文档,该文档说,为避免此警告,除非逗号是一行的第一行,否则逗号前面不应加空格,除非逗号是行的最后一句话,否则逗号后应加空格,但这并不能消除警告。 I don't want to supress the rule in general only in this specific case. 我不想只在这种特定情况下才一般禁止该规则。
Your ,
are place wrongly. 您的,
位置不正确。 It should be like below; 它应该像下面这样; which will get rid off that said StyleCop error 这将摆脱说StyleCop错误
Class test = new Test
{
Test1 = "1",
Test2 = "2",
Test3 = "3", //also ends with another ,
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.