DA0011: Expensive CompareTo

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. 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

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.