Skip to content

Commit

Permalink
Update Property.cs
Browse files Browse the repository at this point in the history
issue with converting object to float or double
  • Loading branch information
senthil-kumar-pa committed Jan 15, 2025
1 parent 2f23aba commit 374c5c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Storage/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ public static string SerializeValue(BacnetValue value, BacnetApplicationTags typ
case BacnetApplicationTags.BACNET_APPLICATION_TAG_NULL:
return value.ToString(); // Modif FC
case BacnetApplicationTags.BACNET_APPLICATION_TAG_REAL:
return ((float)value.Value).ToString(CultureInfo.InvariantCulture);
return float.Parse(value.Value.ToString()).ToString(CultureInfo.InvariantCulture);
case BacnetApplicationTags.BACNET_APPLICATION_TAG_DOUBLE:
return ((double)value.Value).ToString(CultureInfo.InvariantCulture);
return float.Parse(value.Value.ToString()).ToString(CultureInfo.InvariantCulture);
case BacnetApplicationTags.BACNET_APPLICATION_TAG_UNSIGNED_INT:
return uint.Parse(value.Value.ToString()).ToString(CultureInfo.InvariantCulture);
case BacnetApplicationTags.BACNET_APPLICATION_TAG_OCTET_STRING:
return Convert.ToBase64String((byte[])value.Value);
case BacnetApplicationTags.BACNET_APPLICATION_TAG_CONTEXT_SPECIFIC_DECODED:
Expand Down

0 comments on commit 374c5c7

Please sign in to comment.