Gendarme.Rules.Performance.AvoidUninstantiatedInternalClassesRule Class
This rule will fire if a type is only visible within its assembly, can be instantiated, but is not instantiated. Such types are often leftover (dead code) or are debugging/testing code and not required. However in some case the types might by needed, e.g. when accessed thru reflection or if the [InternalsVisibleTo] attribute is used on the assembly.

See Also: AvoidUninstantiatedInternalClassesRule Members

Syntax

[Gendarme.Framework.FxCopCompatibility("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
[Gendarme.Framework.Problem("The internal type is not instantiated by code within the assembly.")]
[Gendarme.Framework.Solution("Remove the type or add the code that uses it. If the type contains only static methods then either add the static modifier to the type or add the private construtor to the type to prevent the compiler from emitting a default public instance constructor.")]
public class AvoidUninstantiatedInternalClassesRule : Gendarme.Framework.Rule, Gendarme.Framework.ITypeRule

Remarks

Documentation for this section has not yet been entered.

Example

Bad example:

Example

            // defined, but never instantiated
            internal class MyInternalClass {
            	// ...
            }
            public class MyClass {
            	static void Main ()
            	{
            		// ...
            	}
            }
            

Example

Good example:

Example

            internal class MyInternalClass {
            	// ...
            }
            public class MyClass {
            	static void Main ()
            	{
            		MyInternalClass c = new MyInternalClass ();
            		// ...
            	}
            }
            

Requirements

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