diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_WaterUseEquipment.cs b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_WaterUseEquipment.cs index 452cafd0..0cb1192e 100644 --- a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_WaterUseEquipment.cs +++ b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_WaterUseEquipment.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using Grasshopper.Kernel; -using Grasshopper.Kernel.Types; namespace Ironbug.Grasshopper.Component { diff --git a/src/Ironbug.HVAC/BaseClass/IB_PropArgumentSet.cs b/src/Ironbug.HVAC/BaseClass/IB_PropArgumentSet.cs index adea3e03..a6125352 100644 --- a/src/Ironbug.HVAC/BaseClass/IB_PropArgumentSet.cs +++ b/src/Ironbug.HVAC/BaseClass/IB_PropArgumentSet.cs @@ -111,7 +111,7 @@ public List GetListByKeyInit(string propertyName, Func> initDefaul this.SetByKey(propertyName, def); return def; } - else if (prop is IEnumerable ls) + else if ((prop is IEnumerable ls) && !(prop is string)) // string is IEnumerable, so check and exclude it { if (prop is List lst) return lst; @@ -159,8 +159,6 @@ internal void OnDeserializedMethod(StreamingContext context) throw new ArgumentException("Failed to deserialize", ex); } - - } @@ -176,16 +174,14 @@ public IB_PropArgumentSet Duplicate() static object Duplicate(object obj) { - if (obj is IEnumerable enu) - { - return enu.Cast().Select(_ => Duplicate(_)); - } + if (obj is string st) + return st; + else if(obj is IEnumerable enu) + return enu.Cast().Select(_ => Duplicate(_)).ToList(); else if (obj is IB_ModelObject mo) return mo.Duplicate(); - else - { + else return obj; - } } public override bool Equals(object obj) => this.Equals(obj as IB_PropArgumentSet); @@ -211,7 +207,11 @@ public bool Equals(IB_PropArgumentSet other) static bool AreSame(object o1, object o2) { var same = true; - if (o1 is IEnumerable enu) + if (o1 is string o1s) // string is IEnumerable + { + return o1s.Equals(o2?.ToString()); + } + else if(o1 is IEnumerable enu) { var o1m = enu.Cast(); var o2m = (o2 as IEnumerable)?.Cast();