Skip to content

Commit 94a0873

Browse files
shethaaditAdit Sheth
andauthored
Fixed bug (#46014)
Co-authored-by: Adit Sheth <adsheth@microsoft.com>
1 parent 652bb96 commit 94a0873

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/csharp/misc/cs0449.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@ ms.assetid: 32c07a2c-4c48-4d07-b643-72422a6b9fac
1010
---
1111
# Compiler Error CS0449
1212

13-
The 'class' or 'struct' constraint must come before any other constraints
14-
15-
The constraints on the type parameter of a generic type or method must occur in a specific order: `class` or `struct` must be first, if present, then any interface constraints, and finally any constructor constraints. This error is caused by the `class` or `struct` constraint not appearing first. To resolve this error, reorder the constraint clauses.
16-
13+
The `'class'`, `'struct'`, `'unmanaged'`, `'notnull'`, and `'default'` constraints cannot be combined or duplicated, and must be specified first in the constraints list.
14+
15+
The constraints on the type parameter of a generic type or method must occur in a specific order: `class` or `struct` must be first, if present, then any interface constraints, and finally any constructor constraints. This error is caused by the `class` or `struct` constraint not appearing first. To resolve this error, reorder the constraint clauses.
16+
1717
## Example
1818

1919
The following sample generates CS0449.
20-
20+
2121
```csharp
2222
// CS0449.cs
2323
// compile with: /target:library
24-
interface I {}
24+
public interface I {} // Made public to avoid CS0703
25+
2526
public class C4
2627
{
2728
public void F1<T>() where T : class, struct, I {} // CS0449
2829
public void F2<T>() where T : I, struct {} // CS0449
2930
public void F3<T>() where T : I, class {} // CS0449
30-
31+
3132
// OK
3233
public void F4<T>() where T : class {}
3334
public void F5<T>() where T : struct {}

0 commit comments

Comments
 (0)