Skip to content

Commit def3587

Browse files
committed
Added documentation to CurrencyUtils.cs
1 parent 32e85bf commit def3587

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Utils/CurrencyUtils.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ namespace Utils
77
{
88
public class CurrencyUtils
99
{
10+
/// <summary>
11+
/// Returns a label of the given currency
12+
/// </summary>
13+
/// <param name="currency">Currency whose label should be returned</param>
14+
/// <returns>Label of the given currency</returns>
1015
public static string GetCurrencyLabel(Currency currency)
1116
{
1217
switch (currency)
@@ -22,6 +27,12 @@ public static string GetCurrencyLabel(Currency currency)
2227
return "UNDEFINED";
2328
}
2429

30+
/// <summary>
31+
/// Format's the given value and currency due to currency's formatting rules
32+
/// </summary>
33+
/// <param name="value">Value to be formatted</param>
34+
/// <param name="currency">Currency to be used</param>
35+
/// <returns>A string containing both the value and the currency symbol in the correct format</returns>
2536
public static string Format(decimal value, Currency currency)
2637
{
2738
var valueStr = DecimalUtils.FormatTwoDecimalPlaces(Math.Abs(value));
@@ -50,6 +61,13 @@ public static string Format(decimal value, Currency currency)
5061
return output;
5162
}
5263

64+
/// <summary>
65+
/// Format's the given value and currency due to currency's formatting rules. Adds the plus symbol when the value
66+
/// is positive.
67+
/// </summary>
68+
/// <param name="value">Value to be formatted</param>
69+
/// <param name="currency">Currency to be used</param>
70+
/// <returns>A string containing both the value and the currency symbol in the correct format</returns>
5371
public static string FormatWithPlusSign(decimal value, Currency currency) =>
5472
(value > 0 ? "+" : "") + Format(value, currency);
5573
}

0 commit comments

Comments
 (0)