From 94de06e842cdb1ad1ff77c0e44b9fa48c4402ca2 Mon Sep 17 00:00:00 2001 From: Claire Kuang Date: Mon, 30 Jun 2025 15:08:43 +0100 Subject: [PATCH] Update SpecklePropertyGoo.cs --- .../Parameters/SpecklePropertyGoo.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Parameters/SpecklePropertyGoo.cs b/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Parameters/SpecklePropertyGoo.cs index 71b9b4a54..8c255a646 100644 --- a/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Parameters/SpecklePropertyGoo.cs +++ b/Connectors/Rhino/Speckle.Connectors.GrasshopperShared/Parameters/SpecklePropertyGoo.cs @@ -126,7 +126,28 @@ public class SpecklePropertyGoo : GH_Goo, ISpecklePropertyGoo { return false; } - - return Value == prop.Value; + switch (Value) + { + case string s: + return s == prop.Value.ToString(); + case bool b: + return prop.Value is bool otherBool + ? b == otherBool + : bool.TryParse(prop.Value.ToString(), out bool parsedBool) && b == parsedBool; + case double d: + return prop.Value is double otherDouble + ? d == otherDouble + : double.TryParse(prop.Value.ToString(), out double parsedDouble) && d == parsedDouble; + case float f: + return prop.Value is float otherFloat + ? f == otherFloat + : float.TryParse(prop.Value.ToString(), out float parsedFloat) && f == parsedFloat; + case int i: + return prop.Value is int otherInt + ? i == otherInt + : int.TryParse(prop.Value.ToString(), out int parsedInt) && i == parsedInt; + default: + return Value == prop.Value; + } } }