diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 85f4e57b..e65a6578 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -10,10 +10,10 @@ Andrew Gubskiy © 2024 Ukrainian .NET Developer Community - 10.5.0-pre - 10.5.0 - 10.5.0 - 10.5.0-pre + 11.0.1 + 11.0.1 + 11.0.1 + 11.0.1-pre git https://github.com/dncuug/X.PagedList.git diff --git a/src/X.PagedList/BasePagedList.cs b/src/X.PagedList/BasePagedList.cs index 3670900d..6e08c87f 100644 --- a/src/X.PagedList/BasePagedList.cs +++ b/src/X.PagedList/BasePagedList.cs @@ -107,8 +107,7 @@ protected internal BasePagedList(int pageNumber, int pageSize, int totalItemCoun if (totalItemCount < 0) { - throw new ArgumentOutOfRangeException( - $"totalItemCount = {totalItemCount}. TotalItemCount cannot be less than 0."); + throw new ArgumentOutOfRangeException($"totalItemCount = {totalItemCount}. TotalItemCount cannot be less than 0."); } // set source to blank list if superset is null to prevent exceptions @@ -172,5 +171,5 @@ IEnumerator IEnumerable.GetEnumerator() /// ///A non-enumerable copy of this paged list. [Obsolete("This method will be removed in future versions")] - public PagedListMetaData GetMetaData() => new(this); + public IPagedList GetMetaData() => new StaticPagedList(new List(), this); } \ No newline at end of file diff --git a/src/X.PagedList/IPagedList.cs b/src/X.PagedList/IPagedList.cs index f4850033..052e29a6 100644 --- a/src/X.PagedList/IPagedList.cs +++ b/src/X.PagedList/IPagedList.cs @@ -18,7 +18,7 @@ public interface IPagedList : IPagedList, IReadOnlyList /// ///A non-enumerable copy of this paged list. [Obsolete("This method will be removed in future versions")] - PagedListMetaData GetMetaData(); + IPagedList GetMetaData(); } /// diff --git a/src/X.PagedList/PagedListMetaData.cs b/src/X.PagedList/PagedListMetaData.cs deleted file mode 100644 index fd0ba484..00000000 --- a/src/X.PagedList/PagedListMetaData.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using JetBrains.Annotations; - -namespace X.PagedList; - -/// -/// Non-enumerable version of the PagedList class. -/// -[PublicAPI] -[Obsolete("This class will be removed in future versions")] -public class PagedListMetaData : IPagedList -{ - /// - /// Protected constructor that allows for instantiation without passing in a separate list. - /// - protected PagedListMetaData() - { - } - - /// - /// Non-enumerable version of the PagedList class. - /// - ///A PagedList (likely enumerable) to copy metadata from. - public PagedListMetaData(IPagedList pagedList) - { - PageCount = pagedList.PageCount; - TotalItemCount = pagedList.TotalItemCount; - PageNumber = pagedList.PageNumber; - PageSize = pagedList.PageSize; - HasPreviousPage = pagedList.HasPreviousPage; - HasNextPage = pagedList.HasNextPage; - IsFirstPage = pagedList.IsFirstPage; - IsLastPage = pagedList.IsLastPage; - FirstItemOnPage = pagedList.FirstItemOnPage; - LastItemOnPage = pagedList.LastItemOnPage; - } - - /// - /// Total number of subsets within the superset. - /// - public int PageCount { get; protected set; } - - /// - /// Total number of objects contained within the superset. - /// - public int TotalItemCount { get; protected set; } - - /// - /// One-based index of this subset within the superset, zero if the superset is empty. - /// - public int PageNumber { get; protected set; } - - /// - /// Maximum size any individual subset. - /// - public int PageSize { get; protected set; } - - /// - /// Returns true if the superset is not empty and PageNumber is less than or equal to PageCount and this - /// is NOT the first subset within the superset. - /// - public bool HasPreviousPage { get; protected set; } - - /// - /// Returns true if the superset is not empty and PageNumber is less than or equal to PageCount and this - /// is NOT the last subset within the superset. - /// - public bool HasNextPage { get; protected set; } - - /// - /// Returns true if the superset is not empty and PageNumber is less than or equal to PageCount and this is - /// the first subset within the superset. - /// - public bool IsFirstPage { get; protected set; } - - /// - /// Returns true if the superset is not empty and PageNumber is less than or equal to PageCount and this is - /// the last subset within the superset. - /// - public bool IsLastPage { get; protected set; } - - /// - /// One-based index of the first item in the paged subset, zero if the superset is empty or PageNumber - /// is greater than PageCount. - /// - public int FirstItemOnPage { get; protected set; } - - /// - /// One-based index of the last item in the paged subset, zero if the superset is empty or PageNumber is - /// greater than PageCount. - /// - public int LastItemOnPage { get; protected set; } -}