DA0011: Expensive CompareTo
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
For the latest documentation on Visual Studio, see DA0011: Expensive CompareTo.
Item | Value |
---|---|
Rule Id | DA0011 |
Category | .NET Framework Usage |
Profiling methods | Sampling .NET Memory |
Message | CompareTo functions should be cheap and not allocate any memory. Reduce complexity of CompareTo function if possible. |
Rule type | Warning |
Cause
The CompareTo method of the type is expensive or allocates memory.
Rule Description
CompareTo methods should be efficient and should not allocate memory.
How to Fix Violations
Reduce the complexity of the CompareTo method.