CA1059: Members should not expose certain concrete types

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

TypeNameMembersShouldNotExposeCertainConcreteTypes
CheckIdCA1059
CategoryMicrosoft.Design
Breaking ChangeBreaking

An externally visible member is a certain concrete type or exposes certain concrete types through one of its parameters or return value. Currently, this rule reports exposure of the following concrete types:

A concrete type is a type that has a complete implementation and therefore can be instantiated. To allow widespread use of the member, replace the concrete type with the suggested interface. This allows the member to accept any type that implements the interface or be used where a type that implements the interface is expected.

The following table lists the targeted concrete types and their suggested replacements.

Concrete typeReplacement
XPathDocumentSystem.Xml.XPath.IXPathNavigable.

Using the interface decouples the member from a specific implementation of an XML data source.

To fix a violation of this rule, change the concrete type to the suggested interface.

It is safe to suppress a message from this rule if the specific functionality provided by the concrete type is required.

CA1011: Consider passing base types as parameters

Show: