Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Development Edition
Design Warnings
 Types should not extend certain bas...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Team System
Types should not extend certain base types

TypeName

TypesShouldNotExtendCertainBaseTypes

CheckId

CA1058

Category

Microsoft.Design

Breaking Change

Breaking

For .NET Framework version 1, it was recommended to derive new exceptions from ApplicationException. The recommendation has changed and new exceptions should derive from System..::.Exception or one of its subclasses in the System namespace.

Do not create a subclass of XmlDocument if you want to create an XML view of an underlying object model or data source.

Non-generic Collections

Use and/or extend generic collections whenever possible. Do not extend non-generic collections in your code, unless you shipped it previously.

Examples of Incorrect Usage

C#
public class MyCollection : CollectionBase
{
}
 
public class MyReadOnlyCollection : ReadOnlyCollectionBase
{
}

Examples of Correct Usage

C#
public class MyCollection : Collection<T>
{
}
 
public class MyReadOnlyCollection : ReadOnlyCollection<T>
{
}

To fix a violation of this rule, derive the type from a different base type or a generic collection.

Do not suppress a warning from this rule for violations about ApplicationException. It is safe to suppress a warning from this rule for violations about XmlDocument. It is safe to suppress a warning about a non-generic collection if the code was released previously.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker