nathanscottdaniels commented on a change in pull request #1404:
URL: https://github.com/apache/avro/pull/1404#discussion_r750645265
##########
File path: lang/csharp/src/apache/main/AvroDecimal.cs
##########
@@ -140,6 +140,55 @@ public override string ToString()
return number;
}
+ /// <summary>
+ /// Returns a new <see cref="AvroDecimal"/> which represents the same
underlying real number as this instance but
+ /// with a scale specified by <paramref name="newScale"/> and <see
cref="UnscaledValue"/> adjusted accordingly.
+ /// </summary>
+ /// <param name="newScale">The new scale to use</param>
+ /// <returns>
+ /// A new <see cref="AvroDecimal"/> which represents the same value as
this instance but
+ /// whose <see cref="Scale"/> is set to <paramref name="newScale"/>
and whose <see cref="UnscaledValue"/>
+ /// is adjusted accordingly.
+ /// </returns>
+ /// <exception cref="OverflowException">
+ /// When <paramref name="newScale"/> is less than the existing <see
cref="Scale"/>
+ /// but reducing the scale of <see cref="UnscaledValue"/> would result
in data loss.
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref
name="newScale"/> was negative</exception>
+ public AvroDecimal ReScale(int newScale)
+ {
+ if (newScale < 0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(newScale), "Must
be greater than or queal to 0");
Review comment:
```suggestion
throw new ArgumentOutOfRangeException(nameof(newScale),
"Must be greater than or equal to 0");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]