From 17aa5284c35e12efd2966a0370ae725514898049 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Tue, 11 Aug 2020 20:28:19 +0200 Subject: [PATCH] Improved floatingpoint-formating of degree and degree celsius data --- OBD.NET/OBD.NET.Common/DataTypes/Degree.cs | 6 ++++++ OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs b/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs index af06dff..1d982f7 100644 --- a/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs +++ b/OBD.NET/OBD.NET.Common/DataTypes/Degree.cs @@ -19,5 +19,11 @@ { } #endregion + + #region Methods + + public override string ToString() => (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit ?? string.Empty); + + #endregion } } diff --git a/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs b/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs index 85d5bdc..cc39dd9 100644 --- a/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs +++ b/OBD.NET/OBD.NET.Common/DataTypes/DegreeCelsius.cs @@ -19,5 +19,11 @@ { } #endregion + + #region Methods + + public override string ToString() => (IsFloatingPointValue ? Value.ToString("0.00") : Value.ToString()) + (Unit ?? string.Empty); + + #endregion } }