Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.28 KB

File metadata and controls

54 lines (39 loc) · 1.28 KB

SA1141

TypeName SA1141UseTupleSyntax
CheckId SA1141
Category Readability Rules

📝 This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic. 📝 This rule is only active for C# 7.0 and higher

Cause

A ValueTuple type declaration was used instead of the preferred tuple language construct.

Rule description

A ValueTuple type declaration was used instead of the preferred tuple language construct. See the documentation on tuple types for information on how to work with tuples in C# 7.

For example, the following code would produce a violation of this rule:

ValueTuple<int, int> x; // SA1141

The following code would not produce any violations:

(int, int) x;

How to fix violations

To fix a violation of this rule, use the appropriate tuple type in code instead of the ValueTuple type.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1141:UseTupleSyntax", Justification = "Reviewed.")]
#pragma warning disable SA1141 // Use tuple syntax
#pragma warning restore SA1141 // Use tuple syntax