Skip to content

Revised addition operator reference - #8539

Merged
rpetrusha merged 2 commits into
dotnet:masterfrom
pkulikov:addition-operator-move-snippets
Oct 23, 2018
Merged

rpetrusha merged 2 commits into
dotnet:masterfrom
pkulikov:addition-operator-move-snippets

Conversation

@pkulikov

Copy link
Copy Markdown
Contributor

Revised addition operators (+ and +=) docs:

@pkulikov

Copy link
Copy Markdown
Contributor Author

As snippets PR is merged, let's close/reopen.

@pkulikov pkulikov closed this Oct 22, 2018
@pkulikov pkulikov reopened this Oct 22, 2018
@pkulikov pkulikov closed this Oct 22, 2018
@pkulikov pkulikov reopened this Oct 22, 2018
@rpetrusha

Copy link
Copy Markdown
Contributor

Build warnings show that merge of examples wasn't recognized. Closing and reopening to begin new build.

@rpetrusha rpetrusha closed this Oct 22, 2018
@rpetrusha rpetrusha reopened this Oct 22, 2018

@rpetrusha rpetrusha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, @pkulikov. Thanks also for moving the code to the samples repo. I've left a couple of suggested changes.


## Example
[!code-csharp[csRefOperators#35](../../../csharp/language-reference/operators/codesnippet/CSharp/addition-assignment-operator_1.cs)]
For numeric types, the [addition operator](addition-operator.md) `+` computes the sum of its operands. If one or both operands of type [string](../keywords/string.md), it concatenates the string representations of its operands. For delegate types, the `+` operator returns a new delegate instance that is combination of its operands.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of type --> is of type


The `+` operator is supported in two forms: a unary plus operator or a binary addition operator.

User-defined types can [overload](../keywords/operator.md) either of unary or binary `+` operators. When a binary `+` operator is overloaded, the [addition assignment operator](addition-assignment-operator.md) `+=` is also implicitly overloaded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either of unary or binary --> the unary and binary


## Unary plus operator

Unary `+` operator returns the value of its operand. It's supported by all numeric types.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unary --> The unary

- the absolute value of `z` is the value produced by `|x| - n * |y|` where `n` is the largest possible integer that is less than or equal to `|x| / |y|` and `|x|` and `|y|` are the absolute values of `x` and `y`, respectively.

For information about behavior of the `%` operator in case of non-finite operands, see the [Remainder operator](~/_csharplang/spec/expressions.md#remainder-operator) section of the [C# language specification](/dotnet/csharp/language-reference/language-specification/index).
For information about behavior of the `%` operator in case of non-finite operands, see the [Remainder operator](~/_csharplang/spec/expressions.md#remainder-operator) section of the [C# language specification](../language-specification/index.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to your PR:

  • behavior --> the behavior
  • in case of --> with

@pkulikov

Copy link
Copy Markdown
Contributor Author

@rpetrusha thanks for review; I've addressed your feedback.

@rpetrusha

Copy link
Copy Markdown
Contributor

Thanks, @pkulikov, for the additional changes. I'll merge your PR now.

@rpetrusha
rpetrusha merged commit c7addcb into dotnet:master Oct 23, 2018
@pkulikov
pkulikov deleted the addition-operator-move-snippets branch October 23, 2018 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants