diff options
| author | Bond-009 <bond.009@outlook.com> | 2024-07-29 18:14:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-29 18:14:49 +0200 |
| commit | eeb8c59ff27307b5edd8e056a9ef7d451dbddd04 (patch) | |
| tree | a3b3e42d2f3466b2613bcdf79f8f5686e4bfe557 | |
| parent | fd5d8bebb9905bf07fe746c59c39122be4cf70ee (diff) | |
| parent | 48b5602144d752b183d260ec255465a436703904 (diff) | |
Merge pull request #12355 from crobibero/querying-nullable
Enable nullability for QueryResult
| -rw-r--r-- | MediaBrowser.Model/Querying/QueryResult.cs | 85 |
1 files changed, 49 insertions, 36 deletions
diff --git a/MediaBrowser.Model/Querying/QueryResult.cs b/MediaBrowser.Model/Querying/QueryResult.cs index ea843f34c..dd0d4fbfc 100644 --- a/MediaBrowser.Model/Querying/QueryResult.cs +++ b/MediaBrowser.Model/Querying/QueryResult.cs @@ -1,47 +1,60 @@ -#nullable disable -#pragma warning disable CS1591 - using System; using System.Collections.Generic; -namespace MediaBrowser.Model.Querying +namespace MediaBrowser.Model.Querying; + +/// <summary> +/// Query result container. +/// </summary> +/// <typeparam name="T">The type of item contained in the query result.</typeparam> +public class QueryResult<T> { - public class QueryResult<T> + /// <summary> + /// Initializes a new instance of the <see cref="QueryResult{T}" /> class. + /// </summary> + public QueryResult() { - public QueryResult() - { - Items = Array.Empty<T>(); - } + Items = Array.Empty<T>(); + } - public QueryResult(IReadOnlyList<T> items) - { - Items = items; - TotalRecordCount = items.Count; - } + /// <summary> + /// Initializes a new instance of the <see cref="QueryResult{T}" /> class. + /// </summary> + /// <param name="items">The list of items.</param> + public QueryResult(IReadOnlyList<T> items) + { + Items = items; + TotalRecordCount = items.Count; + } - public QueryResult(int? startIndex, int? totalRecordCount, IReadOnlyList<T> items) - { - StartIndex = startIndex ?? 0; - TotalRecordCount = totalRecordCount ?? items.Count; - Items = items; - } + /// <summary> + /// Initializes a new instance of the <see cref="QueryResult{T}" /> class. + /// </summary> + /// <param name="startIndex">The start index that was used to build the item list.</param> + /// <param name="totalRecordCount">The total count of items.</param> + /// <param name="items">The list of items.</param> + public QueryResult(int? startIndex, int? totalRecordCount, IReadOnlyList<T> items) + { + StartIndex = startIndex ?? 0; + TotalRecordCount = totalRecordCount ?? items.Count; + Items = items; + } - /// <summary> - /// Gets or sets the items. - /// </summary> - /// <value>The items.</value> - public IReadOnlyList<T> Items { get; set; } + /// <summary> + /// Gets or sets the items. + /// </summary> + /// <value>The items.</value> + public IReadOnlyList<T> Items { get; set; } - /// <summary> - /// Gets or sets the total number of records available. - /// </summary> - /// <value>The total record count.</value> - public int TotalRecordCount { get; set; } + /// <summary> + /// Gets or sets the total number of records available. + /// </summary> + /// <value>The total record count.</value> + public int TotalRecordCount { get; set; } - /// <summary> - /// Gets or sets the index of the first record in Items. - /// </summary> - /// <value>First record index.</value> - public int StartIndex { get; set; } - } + /// <summary> + /// Gets or sets the index of the first record in Items. + /// </summary> + /// <value>First record index.</value> + public int StartIndex { get; set; } } |
