All rules
IDE0340Language rules (expression-level preferences)

Use unbound generic type

Use unbound generic type

Microsoft docs

Description

This rule flags places where the operand of a nameof expression is a bound generic type (for example, List<int>). The code fixer offers to convert the operand to an unbound type (for example, List<>).

Example

// Code with violations.
string name = nameof(List<int>);

// Fixed code.
string name = nameof(List<>);

Configurable options

Vote for the value each option should take in the generated .editorconfig.

csharp_style_prefer_unbound_generic_type_in_nameof
default: true
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0