Skip to content

Commit 9152ee9

Browse files
Update the CS1031 page and remove not needed code
1 parent d6bc798 commit 9152ee9

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

docs/csharp/misc/cs1031.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,27 @@ ms.assetid: 14196659-aaac-4df2-a4ed-0bebb8097d59
1212

1313
Type expected
1414

15-
A type parameter is expected.
16-
17-
## Example
15+
A type has not been specified where expected, when [overloading an operator](../language-reference/operators/operator-overloading.md).
1816

19-
The following sample generates CS1031:
20-
21-
```csharp
22-
// CS1031.cs
23-
namespace x
24-
{
25-
public class ii
26-
{
27-
}
28-
29-
public class a
17+
## Example
18+
19+
The following sample generates CS1031:
20+
21+
```csharp
22+
namespace x
23+
{
24+
public class I
25+
{
26+
}
27+
28+
public class A
3029
{
31-
public static operator +(a aa) // CS1031
32-
// try the following line instead
33-
// public static ii operator +(a aa)
34-
{
35-
return new ii();
36-
}
37-
38-
public static void Main()
39-
{
40-
e = new base; // CS1031, not a type
41-
e = new this; // CS1031, not a type
42-
e = new (); // CS1031, not a type
43-
}
44-
}
45-
}
30+
public static operator +(A aa) // CS1031
31+
// try the following line instead
32+
// public static ii operator +(a aa)
33+
{
34+
return new ii();
35+
}
36+
}
37+
}
4638
```

0 commit comments

Comments
 (0)