Permalink
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (30 sloc) 1.14 KB

SA1026

TypeName SA1026CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation
CheckId SA1026
Category Spacing Rules

Cause

An implicitly typed new array allocation within a C# code file is not spaced correctly.

Rule description

A violation of this rule occurs whenever the code contains an implicitly typed new array allocation which is not spaced correctly. Within an implicitly typed new array allocation, there should not be any space or a blank line between the new keyword and the opening array bracket. For example:

var a = new[] { 1, 10, 100, 1000 };

How to fix violations

To fix a violation of this rule, remove any whitespace between the new keyword and the opening array bracket.

How to suppress violations

#pragma warning disable SA1026 // Code should not contain space after new keyword in implicitly typed array allocation
var ints = new [] { 1, 2, 3 };
#pragma warning restore SA1026 // Code should not contain space after new keyword in implicitly typed array allocation