1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 02:25:41 +00:00

Ensure CLS compliance for method signature

Use overloads instead of optional parameters
This commit is contained in:
Oliver Booth 2021-03-10 12:58:43 +00:00
parent 227e807f14
commit 643a254b87
2 changed files with 22 additions and 2 deletions

View File

@ -108,13 +108,23 @@ namespace X10D.DoubleExtensions
return angle * (180.0 / Math.PI);
}
/// <summary>
/// Rounds the current value to the nearest whole number.
/// </summary>
/// <param name="value">The value to round.</param>
/// <returns><paramref name="value" /> rounded to the nearest whole number.</returns>
public static double Round(this double value)
{
return value.Round(1.0);
}
/// <summary>
/// Rounds the current value to the nearest multiple of a specified number.
/// </summary>
/// <param name="value">The value to round.</param>
/// <param name="nearest">The nearest multiple to which <paramref name="value" /> should be rounded.</param>
/// <returns><paramref name="value" /> rounded to the nearest multiple of <paramref name="nearest"/>.</returns>
public static double Round(this double value, double nearest = 1)
public static double Round(this double value, double nearest)
{
return Math.Round(value / nearest) * nearest;
}

View File

@ -109,13 +109,23 @@ namespace X10D.SingleExtensions
return (float)((double)angle).RadiansToDegrees();
}
/// <summary>
/// Rounds the current value to the nearest whole number.
/// </summary>
/// <param name="value">The value to round.</param>
/// <returns><paramref name="value" /> rounded to the nearest whole number.</returns>
public static float Round(this float value)
{
return value.Round(1.0f);
}
/// <summary>
/// Rounds the current value to the nearest multiple of a specified number.
/// </summary>
/// <param name="value">The value to round.</param>
/// <param name="nearest">The nearest multiple to which <paramref name="value" /> should be rounded.</param>
/// <returns><paramref name="value" /> rounded to the nearest multiple of <paramref name="nearest"/>.</returns>
public static float Round(this float value, float nearest = 1)
public static float Round(this float value, float nearest)
{
return (float)((double)value).Round(nearest);
}