Skip to content

Commit ff17869

Browse files
Compatibility fix at ConvertToInternal: do not create a copy of the object when the target type and object type are the same.
Issue:99361
1 parent c0abce4 commit ff17869

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,15 +2663,15 @@ static public object ConvertToInternal(Type to, Object i)
26632663
{
26642664
o = convertFuncts[to].ConvertToList(i);
26652665
}
2666+
else if (to.IsInstanceOfType(i))
2667+
o = i;
26662668
else if (ienumerableType != null)
26672669
{
26682670
IList lst = (IList)Activator.CreateInstance((typeof(List<>).MakeGenericType(ienumerableType)));
26692671
foreach (object item in i as IEnumerable)
26702672
lst.Add(item);
26712673
o = lst;
26722674
}
2673-
else if (to.IsInstanceOfType(i))
2674-
o = i;
26752675
else
26762676
{
26772677
IList l = (IList)Activator.CreateInstance(to);

0 commit comments

Comments
 (0)