|
1 | 1 | # SpanExtensions
|
2 | 2 |
|
3 | 3 | ## About
|
4 |
| -**`ReadonlySpan<T>`** and **`Span<T>`** are great Types in _C#_, but unfortunately working with them can sometimes be sort of a hassle and some use cases seem straight up impossible, even though they are not. |
5 |
| - |
6 |
| -**SpanExtensions.Net** aims to help developers use `ReadonlySpan<T>` and `Span<T>` more **productively**, **efficiently** and **safely** and write overall more **performant** Programs. |
7 |
| - |
8 |
| -Never again switch back to using `string` instead of `ReadonlySpan<T>`, just because the method you seek is not supported. |
9 |
| - |
10 |
| -**SpanExtensions.Net** provides alternatives for many missing Extension Methods for **`ReadonlySpan<T>`** and **`Span<T>`**, ranging from `string.Split()` over `Enumerable.Skip()` and `Enumerable.Take()` to an improved `ReadOnlySpan<T>.IndexOf()`. |
11 |
| - |
12 |
| -## Methods |
13 |
| -The following **Extension Methods** are contained: |
14 |
| - |
15 |
| -#### String Methods made available for **`ReadonlySpan<T>`** and **`Span<T>`**: |
16 |
| - |
17 |
| -- `(ReadOnly-)Span<T>.Split(T delimiter)` |
18 |
| -- `(ReadOnly-)Span<T>.Split(T delimiter, int count)` |
19 |
| -- `(ReadOnly-)Span<T>.Split(T delimiter, StringSplitOptions options)` |
20 |
| -- `(ReadOnly-)Span<T>.Split(T delimiter, StringSplitOptions options, int count)` |
21 |
| -- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters)` |
22 |
| -- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters, int count)` |
23 |
| -- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters, StringSplitOptions options)` |
24 |
| -- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters, StringSplitOptions options, int count)` |
25 |
| -- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters)` |
26 |
| -- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters, int count)` |
27 |
| -- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters, StringSplitOptions options)` |
28 |
| -- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters, StringSplitOptions options, int count)` |
29 |
| -- `(ReadOnly-)Span<T>.Remove(int startIndex)` |
30 |
| -- `Span<T>.Replace(T oldT, T newT)` |
31 | 4 |
|
32 |
| -#### Linq Methods made available for **`ReadonlySpan<T>`** and **`Span<T>`**: |
| 5 | +Never again switch back to using `string` instead of `ReadonlySpan<T>`, just because the method you seek is not supported. |
33 | 6 |
|
34 |
| -- `(ReadOnly-)Span<T>.All(Predicate<T> predicate)` |
35 |
| -- `(ReadOnly-)Span<T>.Any(Predicate<T> predicate)` |
36 |
| -- `(ReadOnly-)Span<T>.Average()` |
37 |
| -- `(ReadOnly-)Span<T>.Sum()` |
38 |
| -- `(ReadOnly-)Span<T>.Min()` |
39 |
| -- `(ReadOnly-)Span<T>.Max()` |
40 |
| -- `(ReadOnly-)Span<T>.Skip(int count)` |
41 |
| -- `(ReadOnly-)Span<T>.Take(int count)` |
42 |
| -- `(ReadOnly-)Span<T>.SkipLast(int count)` |
43 |
| -- `(ReadOnly-)Span<T>.Takelast(int count)` |
44 |
| -- `(ReadOnly-)Span<T>.SkipWhile(Predicate<T> condition)` |
45 |
| -- `(ReadOnly-)Span<T>.TakeWhile(Predicate<T> condition)` |
46 |
| -- `(Readonly-)Span<T>.First()` |
47 |
| -- `(Readonly-)Span<T>.First(Predicate<T> predicate)` |
48 |
| -- `(Readonly-)Span<T>.FirstOrDefault()` |
49 |
| -- `(Readonly-)Span<T>.FirstOrDefault(Predicate<T> predicate)` |
50 |
| -- `(Readonly-)Span<T>.FirstOrDefault(T defaultValue)` |
51 |
| -- `(Readonly-)Span<T>.FirstOrDefault(Predicate<T> predicate, T defaultValue)` |
52 |
| -- `(Readonly-)Span<T>.Last()` |
53 |
| -- `(Readonly-)Span<T>.Last(Predicate<T> predicate)` |
54 |
| -- `(Readonly-)Span<T>.LastOrDefault()` |
55 |
| -- `(Readonly-)Span<T>.LastOrDefault(Predicate<T> predicate)` |
56 |
| -- `(Readonly-)Span<T>.LastOrDefault(T defaultValue)` |
57 |
| -- `(Readonly-)Span<T>.LastOrDefault(Predicate<T> predicate, T defaultValue)` |
58 |
| -- `(Readonly-)Span<T>.Single()` |
59 |
| -- `(Readonly-)Span<T>.Single(Predicate<T> predicate)` |
60 |
| -- `(Readonly-)Span<T>.SingleOrDefault()` |
61 |
| -- `(Readonly-)Span<T>.SingleOrDefault(Predicate<T> predicate)` |
62 |
| -- `(Readonly-)Span<T>.SingleOrDefault(T defaultValue)` |
63 |
| -- `(Readonly-)Span<T>.SingleOrDefault(Predicate<T> predicate, T defaultValue)` |
64 |
| -- `(Readonly-)Span<T>.ElementAt(int index)` |
65 |
| -- `(Readonly-)Span<T>.ElementAt(Index index)` |
66 |
| -- `(Readonly-)Span<T>.ElementAtOrDefault(int index)` |
67 |
| -- `(Readonly-)Span<T>.ElementAtOrDefault(Index index)` |
68 |
| -- `(Readonly-)Span<T>.ElementAtOrDefault(int index, T defaultValue)` |
69 |
| -- `(Readonly-)Span<T>.ElementAtOrDefault(Index index, T defaultValue)` |
70 |
| -- `(Readonly-)Span<T>.Min()` |
71 |
| -- `(Readonly-)Span<T>.Min(Func<TSource, TResult> selector)` |
72 |
| -- `(Readonly-)Span<T>.MinBy(Func<TSource, TKey> keySelector)` |
73 |
| -- `(Readonly-)Span<T>.MinBy(Func<TSource, TKey> keySelector, IComparer<TKey> comparer)` |
74 |
| -- `(Readonly-)Span<T>.Max()` |
75 |
| -- `(Readonly-)Span<T>.Max(Func<TSource, TResult> selector)` |
76 |
| -- `(Readonly-)Span<T>.MaxBy(Func<TSource, TKey> keySelector)` |
77 |
| -- `(Readonly-)Span<T>.MaxBy(Func<TSource, TKey> keySelector, IComparer<TKey> comparer)` |
| 7 | +**SpanExtensions.Net** aims to help developers use `ReadonlySpan<T>` and `Span<T>` more **productively**, **efficiently** and **safely** and write overall more **performant** Programs. |
78 | 8 |
|
79 | 9 | ## Contributing
|
80 | 10 |
|
81 |
| -Thank you for your interest in contributing to this project! - You may contribute on [Github](https://github.com/draconware-dev/SpanExtensions.Net). |
| 11 | +Thank you for your interest in contributing to this project! - You may contribute on [Github](https://github.com/draconware-dev/SpanExtensions.Net). |
| 12 | + |
82 | 13 | ## License
|
83 | 14 |
|
84 |
| -Copyright (c) draconware-dev. All rights reserved. |
| 15 | +Copyright (c) draconware-dev. All rights reserved. |
85 | 16 |
|
86 | 17 | Licensed under the [MIT](https://github.com/draconware-dev/SpanExtensions.Net/blob/main/LICENSE) license.
|
0 commit comments