This rule does not flag parameters that are named with the discard symbol _. In addition, the rule ignores parameters that are named with the discard symbol followed by an integer, for example, _1. This behavior reduces warning noise on parameters that are needed for signature requirements, for example, a method used as a delegate, a parameter with special attributes, or a parameter whose value is implicitly accessed at run time by a framework but is not referenced in code.
Options
The option value specifies if unused parameters should be flagged only for non-public methods or for both public and non-public methods.
For information about configuring options, see Option format.
dotnet_code_quality_unused_parameters
Property
Value
Description
Option name
dotnet_code_quality_unused_parameters
Option values
all
Flag methods with any accessibility that contain unused parameters
non_public
Flag only non-public methods that contain unused parameters
' dotnet_code_quality_unused_parameters = all
Public Function GetNum1(unused As Integer)
Return 1
End Function
Friend Function GetNum2(unused As Integer)
Return 1
End Function
Private Function GetNum3(unused As Integer)
Return 1
End Function
' dotnet_code_quality_unused_parameters = non_public
Friend Function GetNum4(arg1 As Integer)
Return 1
End Function
Private Function GetNum5(arg1 As Integer)
Return 1
End Function
Suppress a warning
If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
C#
#pragmawarning disable IDE0060// The code that's violating the rule is on this line.#pragmawarning restore IDE0060
To disable the rule for a file, folder, or project, set its severity to none in the configuration file.
Izvor za ovaj sadržaj možete pronaći na GitHubu, gdje možete stvarati i pregledavati probleme i zahtjeve za povlačenjem. Dodatne informacije potražite u našem vodiču za suradnike.
Povratne informacije o proizvodu .NET
.NET je projekt otvorenog koda. Odaberite vezu za slanje povratnih informacija:
Pridružite se seriji susreta kako biste s kolegama programerima i stručnjacima izgradili skalabilna rješenja umjetne inteligencije temeljena na stvarnim slučajevima upotrebe.