Use string interpolation with {0:P;M;Z} format string
This commit is contained in:
parent
7630be7e93
commit
20087cd804
|
@ -200,24 +200,7 @@ namespace BizHawk.Client.Common
|
||||||
/// Get a string representation of difference
|
/// Get a string representation of difference
|
||||||
/// between current value and the previous one
|
/// between current value and the previous one
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Diff
|
public override string Diff => $"{(byte)Math.Abs(_value - _previous):+G;-G;G}";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string diff = "";
|
|
||||||
int diffVal = _value - _previous;
|
|
||||||
if (diffVal > 0)
|
|
||||||
{
|
|
||||||
diff = "+";
|
|
||||||
}
|
|
||||||
else if (diffVal < 0)
|
|
||||||
{
|
|
||||||
diff = "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{diff}{((byte)Math.Abs(diffVal))}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the maximum possible value
|
/// Get the maximum possible value
|
||||||
|
|
|
@ -214,24 +214,7 @@ namespace BizHawk.Client.Common
|
||||||
/// Get a string representation of difference
|
/// Get a string representation of difference
|
||||||
/// between current value and the previous one
|
/// between current value and the previous one
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Diff
|
public override string Diff => $"{(ushort)Math.Abs(_value - _previous):+G;-G;G}";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string diff = "";
|
|
||||||
int diffVal = _value - _previous;
|
|
||||||
if (diffVal > 0)
|
|
||||||
{
|
|
||||||
diff = "+";
|
|
||||||
}
|
|
||||||
else if (diffVal < 0)
|
|
||||||
{
|
|
||||||
diff = "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{diff}{((ushort)Math.Abs(diffVal))}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the maximum possible value
|
/// Get the maximum possible value
|
||||||
|
|
Loading…
Reference in New Issue