Skip to content

Commit 09171a9

Browse files
RexJaeschkeBillWagner
authored andcommitted
add indexers and ranges
1 parent 5f19f2d commit 09171a9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

standard/standard-library.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,44 @@ The following types, including the members listed, must be defined in a conformi
373373

374374
A conforming implementation may provide `Task.GetAwaiter()` and `Task<T>.GetAwaiter()` as extension methods.
375375

376+
> Note to TG2 reviewers: Required vs. Optional library type members: We need to indicate which members of `Index` and `Range` are required and which are optional.
377+
376378
```csharp
377379
namespace System
378380
{
379381
public class FormattableString : IFormattable { }
382+
383+
public readonly struct Index : IEquatable<Index>
384+
{
385+
public Index(int value, bool fromEnd = false);
386+
public static Index End { get; }
387+
public static Index Start { get; }
388+
public bool IsFromEnd { get; }
389+
public int Value { get; }
390+
public static Index FromEnd(int value);
391+
public static Index FromStart(int value);
392+
public bool Equals(Index other);
393+
public override bool Equals(object? value);
394+
public override int GetHashCode();
395+
public int GetOffset(int length);
396+
public override string ToString();
397+
public static implicit operator Index(int value);
398+
}
399+
400+
public struct Range : IEquatable<Range>
401+
{
402+
public Range (Index start, Index end);
403+
public static Range All { get; }
404+
public Index End { get; }
405+
public Index Start { get; }
406+
public static Range EndAt (Index end);
407+
public override bool Equals (object? value);
408+
public bool Equals (Range other);
409+
public override int GetHashCode ();
410+
public (int,int) GetOffsetAndLength (int length);
411+
public static Range StartAt (Index start);
412+
public override string ToString ();
413+
}
380414
}
381415

382416
namespace System.Linq.Expressions
@@ -422,6 +456,11 @@ namespace System.Runtime.CompilerServices
422456
void OnCompleted(Action continuation);
423457
}
424458

459+
public static class RuntimeHelpers
460+
{
461+
public static T[] GetSubArray<T>(T[] array, System.Range range);
462+
}
463+
425464
public struct TaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
426465
{
427466
public bool IsCompleted { get; }

0 commit comments

Comments
 (0)