-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Performance.AvoidLargeStructureRule(2.10)
Assembly: Gendarme.Rules.Performance
Version: 2.10
This rule will fire if a value type (struct in C#) is larger than a maximum value (16 bytes by default). This is a problem because, unlike reference types, value types are bitwise-copied whenever they are assigned to a variable or passed to a method. If the type cannot be reduced in size then it should be turned into a reference type (class in C#).
Bad example:
public struct BigArgb {
long a, r, g, b;
}
Good example:
public sealed class BigArgb {
long a, r, g, b;
}
- This rule is available since Gendarme 2.0
Some elements of this rule can be customized to better fit your needs.
The maximum size structs may be without a defect.
Note that this page was autogenerated (3/17/2011 9:31:58 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!