Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 1.54 KB

SA1316.md

File metadata and controls

64 lines (49 loc) · 1.54 KB

SA1316

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

Cause

Element names within a tuple type should have the correct casing.

Rule description

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()
  {
  }
}

How to fix violations

To fix a violation of this rule, correct the casing of the tuple element name.

How to suppress violations

[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