This rule check for properties which return arrays. This can be a problem because
properties are supposed to execute very quickly so it's likely that this property
is returning a reference to the internal state of the object. This means that
the caller can change the object's internal state via a back-door channel which
is usually a very bad thing and it means that the array's contents may change
unexpectedly if the caller holds onto the array.
The preferred approach is to either return a read-only collection or to change
the property to a method and return a copy of the array (it's important to use
a method so that callers are not misled about the performance of the property).
See Also:
AvoidReturningArraysOnPropertiesRule Members
Syntax
Remarks
Example
Example
Requirements
Namespace: Gendarme.Rules.Performance
Assembly: Gendarme.Rules.Performance (in Gendarme.Rules.Performance.dll)
Assembly Versions: 2.8.0.0