Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule Class
This rule will check for internally visible methods which are never called. The rule will warn you if a private method isn't called in its declaring type or if an internal method doesn't have any callers in the assembly or isn't invoked by the runtime or a delegate.

See Also: AvoidUncalledPrivateCodeRule Members

Syntax

[Gendarme.Framework.FxCopCompatibility("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[Gendarme.Framework.Problem("This private or internal (assembly-level) member does not have callers in the assembly, is not invoked by the common language runtime, and is not invoked by a delegate.")]
[Gendarme.Framework.Solution("Remove the unused code or add code to call it.")]
public class AvoidUncalledPrivateCodeRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule

Remarks

Documentation for this section has not yet been entered.

Example

Bad example:

Example

            public class MyClass {
            	private void MakeSuff ()
            	{
            		// ...
            	}
            	public void Method ()
            	{
            		Console.WriteLine ("Foo");
            	}
            }
            

Example

Good example (removing unused code):

Example

            public class MyClass {
            	public void Method ()
            	{
            		Console.WriteLine ("Foo");
            	}
            }
            

Example

Good example (use the code):

Example

            public class MyClass {
            	private void MakeSuff ()
            	{
            		// ...
            	}
            	public void Method ()
            	{
            		Console.WriteLine ("Foo");
            		MakeSuff ();
            	}
            }
            

Requirements

Namespace: Gendarme.Rules.Performance
Assembly: Gendarme.Rules.Performance (in Gendarme.Rules.Performance.dll)
Assembly Versions: 2.8.0.0