-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
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
overridemodifier 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.
- ID: ec16543f-3b00-8f0c-732f-c70a1f31f864
- Version Independent ID: 91a4400b-2db5-de3e-dd61-952648fb709e
- Content: Compiler Error CS0460
- Content Source: docs/csharp/misc/cs0460.md
- Product: dotnet-csharp
- Technology: csharp-diagnostics
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn