Add support for Indexed Dtos ...

This commit is contained in:
2025-07-19 05:28:43 +03:30
parent 0aa6608b19
commit 3ab7228a37
2 changed files with 12 additions and 2 deletions
+2 -2
View File
@@ -4,8 +4,8 @@ namespace xModels.Dtos
{ {
public class XBaseIndexedDto<T, TIndex> : XBaseDto public class XBaseIndexedDto<T, TIndex> : XBaseDto
{ {
TIndex Index { get; set; } public TIndex Index { get; set; }
T Item { get; set; } public T Item { get; set; }
} }
public class XBaseIntIndexedDto<T> : XBaseIndexedDto<T, int> { } public class XBaseIntIndexedDto<T> : XBaseIndexedDto<T, int> { }
+10
View File
@@ -1,3 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using xCommons.Extensions; using xCommons.Extensions;
using xModels.Dtos; using xModels.Dtos;
@@ -30,5 +33,12 @@ namespace xModels.Extensions
// //
return isSame; return isSame;
} }
public static IEnumerable<T> AsEnumerable<T, TIndex>(
this IEnumerable<XBaseIndexedDto<T, TIndex>> source
)
{
return source.Select(i => i.Item);
}
} }
} }