This rule fires if a zero length array of
System.Type is created.
This value is so often required by the framework API that the
System.Type includes
an
EmptyTypes field. Using this field avoids the memory allocation (and GC tracking)
of your own array.
See Also:
UseTypeEmptyTypesRule Members
Gendarme.Framework.Rule
Gendarme.Rules.Performance.UseTypeEmptyTypesRule
[Gendarme.Framework.EngineDependency(typeof(Gendarme.Framework.Engines.OpCodeEngine, Gendarme.Framework, Version=2.6.1.0, Culture=neutral, PublicKeyToken=null))]
[Gendarme.Framework.Problem("The method creates an empty System.Type array instead of using Type.EmptyTypes.")]
[Gendarme.Framework.Solution("Use Type.EmptyTypes instead of creating your own array.")]
public class
UseTypeEmptyTypesRule :
Gendarme.Framework.Rule,
Gendarme.Framework.IMethodRule
Bad example:
Example
ConstructorInfo ci = type.GetConstructor (new Type[0]);
Good example:
Example
ConstructorInfo ci = type.GetConstructor (Type.EmptyTypes);
Namespace: Gendarme.Rules.Performance
Assembly: Gendarme.Rules.Performance (in Gendarme.Rules.Performance.dll)
Assembly Versions: 2.6.1.0