Skip to content

CS0460 description predates V8 enhancements #32688

@RexJaeschke

Description

@RexJaeschke

While spec'ing V8 features for the Ecma C# standard, I discovered that this page documents the behavior prior to V8, so needs to be be revised to accommodate V8 enhancements. V8 allows explicit class and struct constraints in these two scenarios.

Starting with V8, the error message has been extended, as follows:

Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly***, except for either a ‘class’ or ‘struct' constraint***

The following also needs to be revised:

When a generic method that is part of a derived class overrides a method in the base class, you may not specify constraints on the overridden method. The override method in the derived class inherits its constraints from the method in the base class.[Enter feedback here]

to something like the following:

In the absence of type parameter constraints clauses, a generic method declaration for an explicit interface member implementation inherits any constraints from the constraints on the interface method. Similarly, in the absence of type parameter constraints clauses, a method declaration with the override modifier inherits any constraints from the virtual method being overridden.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions