Skip to content

Commit b8e5f9f

Browse files
Avoid type conversion for ToStringCollection of a GxSimpleCollection<string>
1 parent 79349a8 commit b8e5f9f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

dotnet/src/dotnetframework/GxClasses/Domain/GxCollections.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,20 @@ public virtual void FromJSONObject(dynamic obj)
787787
public GxSimpleCollection<string> ToStringCollection(int digits, int decimals)
788788
{
789789
GxSimpleCollection<string> result = new GxSimpleCollection<string>();
790-
foreach (T item in this)
790+
if (typeof(T) == typeof(string))
791+
{
792+
foreach (T item in this)
793+
{
794+
result.Add(item as string);
795+
}
796+
}
797+
else
791798
{
792-
decimal value = (decimal)Convert.ChangeType(item, typeof(decimal));
793-
result.Add(StringUtil.LTrim(StringUtil.Str(value, digits, decimals)));
799+
foreach (T item in this)
800+
{
801+
decimal value = (decimal)Convert.ChangeType(item, typeof(decimal));
802+
result.Add(StringUtil.LTrim(StringUtil.Str(value, digits, decimals)));
803+
}
794804
}
795805
return result;
796806
}

0 commit comments

Comments
 (0)