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.
Šī satura avotu var atrast vietnē GitHub, kur varat arī izveidot un pārskatīt problēmas un atgādāšanas pieprasījumus. Lai iegūtu papildinformāciju, skatiet mūsu līdzstrādnieku rokasgrāmatu.
.NET atsauksmes
.NET ir atklātā pirmkoda projekts. Atlasiet saiti, lai sniegtu atsauksmes:
Pievienojieties meetup sērijai, lai kopā ar citiem izstrādātājiem un ekspertiem izveidotu mērogojamus AI risinājumus, kuru pamatā ir reālas lietošanas gadījumi.