Enable nullability for QueryResult

pull/12355/head
Cody Robibero 6 months ago
parent fd5d8bebb9
commit 48b5602144

@ -1,47 +1,60 @@
#nullable disable
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; 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) /// <summary>
{ /// Initializes a new instance of the <see cref="QueryResult{T}" /> class.
Items = items; /// </summary>
TotalRecordCount = items.Count; /// <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) /// <summary>
{ /// Initializes a new instance of the <see cref="QueryResult{T}" /> class.
StartIndex = startIndex ?? 0; /// </summary>
TotalRecordCount = totalRecordCount ?? items.Count; /// <param name="startIndex">The start index that was used to build the item list.</param>
Items = items; /// <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> /// <summary>
/// Gets or sets the items. /// Gets or sets the items.
/// </summary> /// </summary>
/// <value>The items.</value> /// <value>The items.</value>
public IReadOnlyList<T> Items { get; set; } public IReadOnlyList<T> Items { get; set; }
/// <summary> /// <summary>
/// Gets or sets the total number of records available. /// Gets or sets the total number of records available.
/// </summary> /// </summary>
/// <value>The total record count.</value> /// <value>The total record count.</value>
public int TotalRecordCount { get; set; } public int TotalRecordCount { get; set; }
/// <summary> /// <summary>
/// Gets or sets the index of the first record in Items. /// Gets or sets the index of the first record in Items.
/// </summary> /// </summary>
/// <value>First record index.</value> /// <value>First record index.</value>
public int StartIndex { get; set; } public int StartIndex { get; set; }
}
} }

Loading…
Cancel
Save