mirror of https://github.com/Squidex/squidex.git
9 changed files with 103 additions and 78 deletions
@ -0,0 +1,17 @@ |
|||||
|
// ==========================================================================
|
||||
|
// IResultList.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Squidex.Infrastructure |
||||
|
{ |
||||
|
public interface IResultList<T> : IReadOnlyList<T> |
||||
|
{ |
||||
|
long Total { get; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
// ==========================================================================
|
||||
|
// ResultList.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Squidex.Infrastructure |
||||
|
{ |
||||
|
public static class ResultList |
||||
|
{ |
||||
|
private sealed class Impl<T> : List<T>, IResultList<T> |
||||
|
{ |
||||
|
public long Total { get; } |
||||
|
|
||||
|
public Impl(IEnumerable<T> items, long total) |
||||
|
: base(items) |
||||
|
{ |
||||
|
Total = total; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static IResultList<T> Create<T>(IEnumerable<T> items, long total) |
||||
|
{ |
||||
|
return new Impl<T>(items, total); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue