-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIReadOnlySequence.cs
54 lines (46 loc) · 1.35 KB
/
IReadOnlySequence.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Grammophone.GenericContentModel
{
/// <summary>
/// Interface for read-only container of ordered items.
/// </summary>
/// <typeparam name="T">The type of items in the container.</typeparam>
/// <remarks>
/// The interface isn't called IReadOnlyList in order to avoid collision with
/// the upcoming System.Collections.Generic.IReadOnlyCollection interface of .NET 4.5.
/// </remarks>
public interface IReadOnlySequence<out T> :
IReadOnlyBag<T>
#if NET_45_OR_GREATER
, IReadOnlyList<T>
#endif
{
#if !NET_45_OR_GREATER
#region Properties
/// <summary>
/// Get collection item by its index.
/// </summary>
/// <param name="index">The index of the item.</param>
/// <returns>Returns the item at the index.</returns>
/// <exception cref="ArgumentOutOfRangeException">
/// When <paramref name="index"/> is negative or
/// greater or equal to <see cref="IReadOnlyBag{T}.Count"/>.
/// </exception>
T this[int index] { get; }
#endregion
#endif
#region Methods
/// <summary>
/// Get the elements of the collection as an array.
/// </summary>
/// <returns>Returns the array.</returns>
/// <remarks>
/// The returned array is cached. Changing its items might affect other callers.
/// </remarks>
T[] ToArray();
#endregion
}
}