Gendarme Rule: Avoid unused parameters.

8 views
Skip to first unread message

Néstor Salceda

unread,
Jul 30, 2007, 12:42:16 PM7/30/07
to mono-soc-2007
Hello,

Title: Avoid unused parameters.

Description: The rule should ensure that all parameters in a method are
used.

Some methods will be skipped:

* Methods referenced by a delegate.
* Methods used as event handlers.
* Methods declared with the abstract modifier.
* Methods declared with the virtual modifier.
* Methods declared with the override modifier.
* Methods declared with the extern modifier.

References:

http://www.gotdotnet.com/Team/FxCop/Docs/Rules/Performance/AvoidUnusedParameters.html

Examples:

Good:

public void PrintBanner (Version version)
{
Console.WriteLine ("This is the foo program {0}", version);
}

Bad:

public void PrintBanner (Version version)
{
Console.WriteLine ("This is the foo program {0}",
Assembly.GetExecutingAssembly ().GetName ().Version);
}

Good:

public void PrintBanner ()
{
Console.WriteLine ("This is the foo program {0}",
Assembly.GetExecutingAssembly ().GetName ().Version);
}


Néstor Salceda

unread,
Aug 2, 2007, 10:44:10 AM8/2/07
to mono-soc-2007
Reply all
Reply to author
Forward
0 new messages