From b9059e1b85cc91873a72f9f07a178df934abacc6 Mon Sep 17 00:00:00 2001 From: Claire Kuang Date: Thu, 1 Feb 2024 10:20:36 +0000 Subject: [PATCH] Update AutomateFunction.cs --- SpeckleAutomateDotnetExample/AutomateFunction.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/SpeckleAutomateDotnetExample/AutomateFunction.cs b/SpeckleAutomateDotnetExample/AutomateFunction.cs index 28abd1a..274a3ad 100644 --- a/SpeckleAutomateDotnetExample/AutomateFunction.cs +++ b/SpeckleAutomateDotnetExample/AutomateFunction.cs @@ -122,8 +122,19 @@ static class AutomateFunction bool changed = !Equals(entry.Value, releaseObjectPropDict[entry.Key]); if (changed) { - string diff = - $"Property ({entry.Key}) changed from ({releaseObjectPropDict[entry.Key]}) to ({entry.Value})"; + object? releaseValue = releaseObjectPropDict[entry.Key]; + object? testValue = entry.Value; + string diff = $"Property ({entry.Key}) changed"; + if ( + releaseValue is not null + && testValue is not null + && !releaseValue.GetType().Equals(testValue.GetType()) + ) + { + diff += + $" from ({releaseObjectPropDict[entry.Key]}) to ({entry.Value})"; + } + if (!diffDictionary.ContainsKey(entry.Key)) { diffDictionary.Add(entry.Key, diff);