Merge pull request #12355 from crobibero/querying-nullable

Enable nullability for QueryResult
This commit is contained in:
Bond-009 2024-07-29 18:14:49 +02:00 committed by GitHub
commit eeb8c59ff2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,24 +1,38 @@
#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()
{
Items = Array.Empty<T>();
}
/// <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;
}
/// <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;
@ -43,5 +57,4 @@ namespace MediaBrowser.Model.Querying
/// </summary>
/// <value>First record index.</value>
public int StartIndex { get; set; }
}
}