File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
cpp/VS_Snippets_CLR/IComparable`1 Example/CPP
csharp/VS_Snippets_CLR/IComparable`1 Example/CS
visualbasic/VS_Snippets_CLR/IComparable`1 Example/VB Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,19 @@ public ref class Temperature: public IComparable<Temperature^> {
27
27
// Define the is greater than operator.
28
28
bool operator >= (Temperature^ other)
29
29
{
30
- return CompareTo (other) == 1 ;
30
+ return CompareTo (other) >= 0 ;
31
31
}
32
32
33
33
// Define the is less than operator.
34
34
bool operator < (Temperature^ other)
35
35
{
36
- return CompareTo (other) == - 1 ;
36
+ return CompareTo (other) < 0 ;
37
37
}
38
38
39
39
// Define the is greater than or equal to operator.
40
40
bool operator > (Temperature^ other)
41
41
{
42
- return CompareTo (other) >= 0 ;
42
+ return CompareTo (other) > 0 ;
43
43
}
44
44
45
45
// Define the is less than or equal to operator.
Original file line number Diff line number Diff line change @@ -20,13 +20,13 @@ public int CompareTo(Temperature other)
20
20
// Define the is greater than operator.
21
21
public static bool operator > ( Temperature operand1 , Temperature operand2 )
22
22
{
23
- return operand1 . CompareTo ( operand2 ) == 1 ;
23
+ return operand1 . CompareTo ( operand2 ) > 0 ;
24
24
}
25
25
26
26
// Define the is less than operator.
27
27
public static bool operator < ( Temperature operand1 , Temperature operand2 )
28
28
{
29
- return operand1 . CompareTo ( operand2 ) == - 1 ;
29
+ return operand1 . CompareTo ( operand2 ) < 0 ;
30
30
}
31
31
32
32
// Define the is greater than or equal to operator.
Original file line number Diff line number Diff line change @@ -20,12 +20,12 @@ Public Class Temperature
20
20
21
21
' Define the is greater than operator.
22
22
Public Shared Operator > (operand1 As Temperature, operand2 As Temperature) As Boolean
23
- Return operand1.CompareTo(operand2) = 1
23
+ Return operand1.CompareTo(operand2) > 0
24
24
End Operator
25
25
26
26
' Define the is less than operator.
27
27
Public Shared Operator < (operand1 As Temperature, operand2 As Temperature) As Boolean
28
- Return operand1.CompareTo(operand2) = - 1
28
+ Return operand1.CompareTo(operand2) < 0
29
29
End Operator
30
30
31
31
' Define the is greater than or equal to operator.
You can’t perform that action at this time.
0 commit comments