generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathICollectionResultT2.cs
39 lines (33 loc) · 1.69 KB
/
ICollectionResultT2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net.Http;
namespace CoreEx.Entities
{
/// <summary>
/// Provides the typed <typeparamref name="TItem"/> <see cref="Items"/>.
/// </summary>
/// <typeparam name="TColl">The result collection <see cref="Type"/>.</typeparam>
/// <typeparam name="TItem">The underlying item <see cref="Type"/>.</typeparam>
/// <remarks>Generally an <see cref="ICollectionResult"/> is not intended for serialized <see cref="HttpResponseMessage"/>; the underlying <see cref="Items"/> is serialized with the <see cref="ICollectionResult.Paging"/> returned as <see cref="HttpResponseMessage.Headers"/>.</remarks>
public interface ICollectionResult<TColl, TItem> : ICollectionResult<TItem> where TColl : ICollection<TItem>, new()
{
/// <inheritdoc/>
Type ICollectionResult.ItemType => typeof(TItem);
/// <inheritdoc/>
Type ICollectionResult.CollectionType => typeof(TColl);
/// <summary>
/// Gets or sets the underlying collection.
/// </summary>
new TColl Items { get; set; }
/// <summary>
/// Gets the underlying <see cref="ICollection"/>.
/// </summary>
ICollection ICollectionResult.Items { get => (ICollection)Items; set => Items = value == null ? new TColl() : (TColl)value; }
/// <summary>
/// Gets the underlying <see cref="ICollection{TEntity}"/>.
/// </summary>
ICollection<TItem> ICollectionResult<TItem>.Items { get => Items; set => Items = value == null ? new TColl() : (TColl)value; }
}
}