diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/greater-than-equal-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/greater-than-equal-operator_1.cs deleted file mode 100644 index f96aac9933fd4..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/greater-than-equal-operator_1.cs +++ /dev/null @@ -1,13 +0,0 @@ - class GTE - { - static void Main() - { - Console.WriteLine(1.1 >= 1); - Console.WriteLine(1.1 >= 1.1); - } - } - /* - Output: - True - True - */ \ No newline at end of file diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/greater-than-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/greater-than-operator_1.cs deleted file mode 100644 index 46513b7a0af82..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/greater-than-operator_1.cs +++ /dev/null @@ -1,13 +0,0 @@ - class GT - { - static void Main() - { - Console.WriteLine(1.1 > 1); - Console.WriteLine(1.1 > 1.1); - } - } - /* - Output: - True - False - */ \ No newline at end of file diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/less-than-equal-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/less-than-equal-operator_1.cs deleted file mode 100644 index 0964dab88a706..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/less-than-equal-operator_1.cs +++ /dev/null @@ -1,13 +0,0 @@ - class LTE - { - static void Main() - { - Console.WriteLine(1 <= 1.1); - Console.WriteLine(1.1 <= 1.1); - } - } - /* - Output: - True - True - */ \ No newline at end of file diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/less-than-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/less-than-operator_1.cs deleted file mode 100644 index fd5e6a60412b9..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/less-than-operator_1.cs +++ /dev/null @@ -1,13 +0,0 @@ - class LT - { - static void Main() - { - Console.WriteLine(1 < 1.1); - Console.WriteLine(1.1 < 1.1); - } - } - /* - Output: - True - False - */ \ No newline at end of file diff --git a/docs/csharp/language-reference/operators/equality-comparison-operator.md b/docs/csharp/language-reference/operators/equality-comparison-operator.md index f3df75947fa72..ff5350699ef11 100644 --- a/docs/csharp/language-reference/operators/equality-comparison-operator.md +++ b/docs/csharp/language-reference/operators/equality-comparison-operator.md @@ -19,6 +19,9 @@ Operands of the [built-in value types](../keywords/value-types-table.md) are equ [!code-csharp-interactive[value types equality](~/samples/snippets/csharp/language-reference/operators/EqualityAndNonEqualityExamples.cs#ValueTypesEquality)] +> [!NOTE] +> For relational operators `==`, `>`, `<`, `>=`, and `<=`, if any of the operands is not a number ( or ) the result of operation is `false`. That means that the `NaN` value is neither greater than, less than, nor equal to any other `double` (or `float`) value. For more information and examples, see the or reference article. + Two operands of the same [enum](../keywords/enum.md) type are equal if the corresponding values of the underlying integral type are equal. By default, the `==` operator is not defined for a user-defined [struct](../keywords/struct.md) type. A user-defined type can [overload](#operator-overloadability) the `==` operator. diff --git a/docs/csharp/language-reference/operators/greater-than-equal-operator.md b/docs/csharp/language-reference/operators/greater-than-equal-operator.md index ab9da42832c64..256b6e2bb2cbc 100644 --- a/docs/csharp/language-reference/operators/greater-than-equal-operator.md +++ b/docs/csharp/language-reference/operators/greater-than-equal-operator.md @@ -1,8 +1,7 @@ --- title: ">= Operator - C# Reference" ms.custom: seodec18 - -ms.date: 07/20/2015 +ms.date: 12/18/2018 f1_keywords: - ">=_CSharpKeyword" helpviewer_keywords: @@ -11,16 +10,29 @@ helpviewer_keywords: ms.assetid: 0db4dcaf-56a3-4884-a7ad-35f64978a58d --- # >= Operator (C# Reference) -All numeric and enumeration types define a "greater than or equal" relational operator, `>=` that returns `true` if the first operand is greater than or equal to the second, `false` otherwise. - -## Remarks - User-defined types can overload the `>=` operator. For more information, see [operator](../../../csharp/language-reference/keywords/operator.md). If `>=` is overloaded, [<=](../../../csharp/language-reference/operators/less-than-equal-operator.md) must also be overloaded. Operations on integral types are generally allowed on enumeration. - -## Example - [!code-csharp[csRefOperators#39](../../../csharp/language-reference/operators/codesnippet/CSharp/greater-than-equal-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) + +The "greater than or equal" relational operator `>=` returns `true` if its first operand is greater than or equal to its second operand, `false` otherwise. All numeric and enumeration types support the `>=` operator. For operands of the same [enum](../keywords/enum.md) type, the corresponding values of the underlying integral type are compared. + +> [!NOTE] +> For relational operators `==`, `>`, `<`, `>=`, and `<=`, if any of the operands is not a number ( or ) the result of operation is `false`. That means that the `NaN` value is neither greater than, less than, nor equal to any other `double` (or `float`) value. For more information and examples, see the or reference article. + +The following example demonstrates the usage of the `>=` operator: + +[!code-csharp-interactive[greater than or equal example](~/samples/snippets/csharp/language-reference/operators/GreaterAndLessOperatorsExamples.cs#GreaterOrEqual)] + +## Operator overloadability + +User-defined types can [overload](../keywords/operator.md) the `>=` operator. If a type overloads the "greater than or equal" operator `>=`, it must also overload the ["less than or equal" operator](less-than-equal-operator.md) `<=`. + +## C# language specification + +For more information, see the [Relational and type-testing operators](~/_csharplang/spec/expressions.md#relational-and-type-testing-operators) section of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [> Operator](greater-than-operator.md) +- [== Operator](equality-comparison-operator.md) +- diff --git a/docs/csharp/language-reference/operators/greater-than-operator.md b/docs/csharp/language-reference/operators/greater-than-operator.md index aee91143109c2..920906d99db1d 100644 --- a/docs/csharp/language-reference/operators/greater-than-operator.md +++ b/docs/csharp/language-reference/operators/greater-than-operator.md @@ -1,8 +1,7 @@ --- title: "> Operator - C# Reference" ms.custom: seodec18 - -ms.date: 07/20/2015 +ms.date: 12/18/2018 f1_keywords: - ">_CSharpKeyword" helpviewer_keywords: @@ -11,17 +10,28 @@ helpviewer_keywords: ms.assetid: 26d3cb69-9c0b-4cc5-858b-5be1abd6659d --- # > Operator (C# Reference) -All numeric and enumeration types define a "greater than" relational operator (`>`) that returns `true` if the first operand is greater than the second, `false` otherwise. - -## Remarks - User-defined types can overload the `>` operator (see [operator](../../../csharp/language-reference/keywords/operator.md)). If `>` is overloaded, [<](../../../csharp/language-reference/operators/less-than-operator.md) must also be overloaded. - -## Example - [!code-csharp[csRefOperators#29](../../../csharp/language-reference/operators/codesnippet/CSharp/greater-than-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) -- [explicit](../../../csharp/language-reference/keywords/explicit.md) + +The "greater than" relational operator `>` returns `true` if its first operand is greater than its second operand, `false` otherwise. All numeric and enumeration types support the `>` operator. For operands of the same [enum](../keywords/enum.md) type, the corresponding values of the underlying integral type are compared. + +> [!NOTE] +> For relational operators `==`, `>`, `<`, `>=`, and `<=`, if any of the operands is not a number ( or ) the result of operation is `false`. That means that the `NaN` value is neither greater than, less than, nor equal to any other `double` (or `float`) value. For more information and examples, see the or reference article. + +The following example demonstrates the usage of the `>` operator: + +[!code-csharp-interactive[greater than example](~/samples/snippets/csharp/language-reference/operators/GreaterAndLessOperatorsExamples.cs#Greater)] + +## Operator overloadability + +User-defined types can [overload](../keywords/operator.md) the `>` operator. If a type overloads the "greater than" operator `>`, it must also overload the ["less than" operator](less-than-operator.md) `<`. + +## C# language specification + +For more information, see the [Relational and type-testing operators](~/_csharplang/spec/expressions.md#relational-and-type-testing-operators) section of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [>= Operator](greater-than-equal-operator.md) +- diff --git a/docs/csharp/language-reference/operators/less-than-equal-operator.md b/docs/csharp/language-reference/operators/less-than-equal-operator.md index 71e41de92a60c..770d586ae7e30 100644 --- a/docs/csharp/language-reference/operators/less-than-equal-operator.md +++ b/docs/csharp/language-reference/operators/less-than-equal-operator.md @@ -1,8 +1,7 @@ --- title: "<= Operator - C# Reference" ms.custom: seodec18 - -ms.date: 07/20/2015 +ms.date: 12/18/2018 f1_keywords: - "<=_CSharpKeyword" helpviewer_keywords: @@ -11,17 +10,29 @@ helpviewer_keywords: ms.assetid: bb0caec9-d253-4105-b8bc-5252233251e4 --- # <= Operator (C# Reference) -All numeric and enumeration types define a "less than or equal" relational operator (`<=`) that returns `true` if the first operand is less than or equal to the second, `false` otherwise. - -## Remarks - User-defined types can overload the `<=` operator. For more information, see [operator](../../../csharp/language-reference/keywords/operator.md). If `<=` is overloaded, [>=](../../../csharp/language-reference/operators/greater-than-equal-operator.md) must also be overloaded. Operations on integral types are generally allowed on enumeration. - -## Example - [!code-csharp[csRefOperators#32](../../../csharp/language-reference/operators/codesnippet/CSharp/less-than-equal-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) -- [explicit](../../../csharp/language-reference/keywords/explicit.md) + +The "less than or equal" relational operator `<=` returns `true` if its first operand is less than or equal to its second operand, `false` otherwise. All numeric and enumeration types support the `<=` operator. For operands of the same [enum](../keywords/enum.md) type, the corresponding values of the underlying integral type are compared. + +> [!NOTE] +> For relational operators `==`, `>`, `<`, `>=`, and `<=`, if any of the operands is not a number ( or ) the result of operation is `false`. That means that the `NaN` value is neither greater than, less than, nor equal to any other `double` (or `float`) value. For more information and examples, see the or reference article. + +The following example demonstrates the usage of the `<=` operator: + +[!code-csharp-interactive[less than or equal example](~/samples/snippets/csharp/language-reference/operators/GreaterAndLessOperatorsExamples.cs#LessOrEqual)] + +## Operator overloadability + +User-defined types can [overload](../keywords/operator.md) the `<=` operator. If a type overloads the "less than or equal" operator `<=`, it must also overload the ["greater than or equal" operator](greater-than-equal-operator.md) `>=`. + +## C# language specification + +For more information, see the [Relational and type-testing operators](~/_csharplang/spec/expressions.md#relational-and-type-testing-operators) section of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [< Operator](less-than-operator.md) +- [== Operator](equality-comparison-operator.md) +- diff --git a/docs/csharp/language-reference/operators/less-than-operator.md b/docs/csharp/language-reference/operators/less-than-operator.md index 55b43bbb68b87..6881760a799d3 100644 --- a/docs/csharp/language-reference/operators/less-than-operator.md +++ b/docs/csharp/language-reference/operators/less-than-operator.md @@ -1,8 +1,7 @@ --- title: "< Operator - C# Reference" ms.custom: seodec18 - -ms.date: 07/20/2015 +ms.date: 12/18/2018 f1_keywords: - "<_CSharpKeyword" helpviewer_keywords: @@ -11,16 +10,28 @@ helpviewer_keywords: ms.assetid: 38cb91e6-79a6-48ec-9c1e-7b71fd8d2b41 --- # < Operator (C# Reference) -All numeric and enumeration types define a "less than" relational operator (`<`) that returns `true` if the first operand is less than the second, `false` otherwise. - -## Remarks - User-defined types can overload the `<` operator (see [operator](../../../csharp/language-reference/keywords/operator.md)). If `<` is overloaded, [>](../../../csharp/language-reference/operators/greater-than-operator.md) must also be overloaded. - -## Example - [!code-csharp[csRefOperators#24](../../../csharp/language-reference/operators/codesnippet/CSharp/less-than-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) + +The "less than" relational operator `<` returns `true` if its first operand is less than its second operand, `false` otherwise. All numeric and enumeration types support the `<` operator. For operands of the same [enum](../keywords/enum.md) type, the corresponding values of the underlying integral type are compared. + +> [!NOTE] +> For relational operators `==`, `>`, `<`, `>=`, and `<=`, if any of the operands is not a number ( or ) the result of operation is `false`. That means that the `NaN` value is neither greater than, less than, nor equal to any other `double` (or `float`) value. For more information and examples, see the or reference article. + +The following example demonstrates the usage of the `<` operator: + +[!code-csharp-interactive[less than example](~/samples/snippets/csharp/language-reference/operators/GreaterAndLessOperatorsExamples.cs#Less)] + +## Operator overloadability + +User-defined types can [overload](../keywords/operator.md) the `<` operator. If a type overloads the "less than" operator `<`, it must also overload the ["greater than" operator](greater-than-operator.md) `>`. + +## C# language specification + +For more information, see the [Relational and type-testing operators](~/_csharplang/spec/expressions.md#relational-and-type-testing-operators) section of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [<= Operator](less-than-equal-operator.md) +-