CA1506: Avoid excessive class coupling

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

Item Value
TypeName AvoidExcessiveClassCoupling
CheckId CA1506
Category Microsoft.Maintainability
Breaking Change Breaking

Cause

A type or method is coupled with many other types.

Rule Description

This rule measures class coupling by counting the number of unique type references that a type or method contains.

Types and methods that have a high degree of class coupling can be difficult to maintain. It is a good practice to have types and methods that exhibit low coupling and high cohesion.

How to Fix Violations

To fix this violation, try to redesign the type or method to reduce the number of types to which it is coupled.

When to Suppress Warnings

Exclude this warning when the type or method is still considered maintainable despite its large number of dependencies on other types.

See Also

Maintainability Warnings Measuring Complexity and Maintainability of Managed Code