TypeName | SA1316TupleElementNamesShouldUseCorrectCasing |
CheckId | SA1316 |
Category | Naming 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
Element names within a tuple type should have the correct casing.
Tuple types with element names should use the configured casing for the element names (see Configuration.md for details). 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 (with default settings):
public class ExampleClass
{
public (int valueA, int valueB) ExampleMethod() // SA1316
{
}
}
The following code would not produce any violations:
public class ExampleClass
{
public (int ValueA, int ValueB) ExampleMethod()
{
}
}
To fix a violation of this rule, correct the casing of the tuple element name.
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1316:TupleElementNamesShouldUseCorrectCasing", Justification = "Reviewed.")]
#pragma warning disable SA1316 // Tuple element names should use correct casing
#pragma warning restore SA1316 // Tuple element names should use correct casing