Skip to content

Commit 72bf0b1

Browse files
lhakArlodotexe
authored andcommitted
Use generic arguments if possible to get type of elements in lists
1 parent a9fdaab commit 72bf0b1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,18 @@ int IComparer<object>.Compare(object x, object y)
382382
{
383383
if (!_sortProperties.Any())
384384
{
385-
var type = x.GetType();
385+
var listType = _source?.GetType();
386+
Type type;
387+
388+
if (listType != null && listType.IsGenericType)
389+
{
390+
type = listType.GetGenericArguments()[0];
391+
}
392+
else
393+
{
394+
type = x.GetType();
395+
}
396+
386397
foreach (var sd in _sortDescriptions)
387398
{
388399
if (!string.IsNullOrEmpty(sd.PropertyName))

0 commit comments

Comments
 (0)