use-tuple-syntax
What it does
Section titled “What it does”Reports ValueTuple<int, int> and ValueTuple.Create(a, b) where tuple syntax ((int, int) and (a, b)) can be used; not inside an expression tree. The fix is offered for types and ValueTuple.Create calls.
Why it matters
Section titled “Why it matters”The tuple syntax is the form of the language, short and the one that supports element names. ValueTuple<...> is the type it compiles to, so writing it out is noise.
Example
Section titled “Example”... class Q : P, I { public (int, int) Pair() => (1, 2);... public void Go(ValueTuple<int, int> t) {... var g = ValueTuple.Create(1, 2);... Debug.Assert(true, "why");...... class Q : P, I { public (int, int) Pair() => (1, 2);... public void Go((int, int) t) {... var g = (1, 2);... Debug.Assert(true, "why");...Configuration
Section titled “Configuration”csharp: lint: rules: use-tuple-syntax: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line use-tuple-syntax in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1141 |
full |