【问题标题】:StyleCop formattingStyleCop 格式
【发布时间】:2010-11-07 00:21:23
【问题描述】:

如何格式化以下行以消除 StyleCop 警告:

this.BeginInvoke(this.updateHandler,new object[]{this.tmpbuf});

现在,我收到 4 个警告:

  • Warning 4 SA1001: Invalid spacing around the comma.
  • Warning 5 SA1011: Invalid spacing around the closing square bracket.
  • Warning 6 SA1012: Invalid spacing around the opening curly bracket.
  • Warning 7 SA1013: Invalid spacing around the closing curly bracket.

【问题讨论】:

  • CTRL+K 后跟 CTRL+D 将为您修复 Visual Studio 中当前代码文件中的格式。
  • 风格警察——真是个笑话。当我拼错一个单词时,我的拼写检查器会提供纠正它。它没有说“无效的拼写”,让我去猜测。

标签: c# stylecop


【解决方案1】:
this.BeginInvoke(this.updateHandler, new object[] { this.tmpbuf });
  • SA1001 逗号后需要空格
  • SA1011 关闭方括号后需要空格
  • SA1012 打开大括号后需要空格
  • SA1013 在关闭大括号之前需要空格

有关规则的完整说明,请参阅StyleCop spacing rules

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-03-28
  • 2011-01-23
  • 2013-03-15
  • 2011-05-07
  • 2012-03-07
  • 2010-12-25
  • 1970-01-01
相关资源
最近更新 更多