TypeName | SA1414TupleTypesInSignaturesShouldHaveElementNames |
CheckId | SA1414 |
Category | Maintainability 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
A tuple type without element names is present in a member declaration.
Tuple types appearing in member declarations should have explicitly named elements. 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:
public class ExampleClass
{
public (int, int) ExampleMethod() // SA1414
{
}
}
The following code would not produce any violations:
public class ExampleClass
{
public (int valueA, int valueB) ExampleMethod()
{
}
}
To fix a violation of this rule, provide an element name for each tuple element.
[SuppressMessage("StyleCop.CSharp.MaintainAbilityRules", "SA1414:TupleTypesInSignaturesShouldHaveElementNames", Justification = "Reviewed.")]
#pragma warning disable SA1414 // Tuple types appearing in member declarations should have explicitly named tuple elements
#pragma warning restore SA1414 // Tuple types appearing in member declarations should have explicitly named tuple elements