StyleCop formatting

user131077 picture user131077 · Jun 30, 2009 · Viewed 11.2k times · Source

How can I format the following line to eliminate StyleCop warnings:

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

Now, I get 4 warnings:

  • 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.

Answer

Knut Haugen picture Knut Haugen · Jun 30, 2009
this.BeginInvoke(this.updateHandler, new object[] { this.tmpbuf });
  • SA1001 requires space after a comma
  • SA1011 requires space after closing square bracket
  • SA1012 requires space after opening curly bracket
  • SA1013 requires space before closing curly bracket

See StyleCop spacing rules for full description of the relevant rules.