S119 — Generic type parameter names should comply with a naming convention

Language
VB.NET
Type
Code smell
Severity
Minor
Tags
convention

Why is this an issue?

Inconsistent naming conventions can lead to confusion and errors when working in a team. This rule ensures that all generic type parameter names follow a consistent naming convention by checking them against a provided regular expression.

The default configuration follows Microsoft’s recommended convention:

How to fix it

To fix this issue, ensure that all generic type parameter names in your code follow the naming convention specified in the regular expression.

Code examples

Noncompliant code example

With the default parameter value ^T(([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?)?$:


Public Class Foo(Of tkey) ' Noncompliant
End Class

Compliant solution


Public Class Foo(Of TKey) ' Compliant
End Class

Resources

Documentation

↑ Back to top