File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ ms.assetid: 14196659-aaac-4df2-a4ed-0bebb8097d59
1313Type expected
1414
1515A type has not been specified where expected, when [ overloading an operator] ( ../language-reference/operators/operator-overloading.md ) .
16+ <br />Missing * type* in this case means that there's no * type* given for the return type of the overloaded operator.
17+ This error shouldn't be confused with missing [ generic type parameter] ( ../../csharp/programming-guide/generics/generic-type-parameters.md ) .
1618
1719## Example
1820
@@ -27,11 +29,14 @@ namespace x
2729
2830 public class A
2931 {
30- public static operator +(A aa) // CS1031
31- // try the following line instead
32- // public static ii operator +(a aa)
32+ public static operator +(A a) // CS1031 - Overloaded operator missing a type
3333 {
34- return new ii ();
34+ return new I ();
35+ }
36+
37+ public static I operator +(A a) // Correct - type was specified
38+ {
39+ return new I();
3540 }
3641 }
3742}
You can’t perform that action at this time.
0 commit comments