SA1141.md
April 12, 2019 ยท View on GitHub
SA1141
| TypeName | SA1141UseTupleSyntax |
| CheckId | SA1141 |
| Category | Readability Rules |
:memo: This rule is new for StyleCop Analyzers, and was not present in StyleCop Classic. :memo: 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