Skip to content

Commit e152549

Browse files
committed
prepared for version 2
1 parent 0c082e8 commit e152549

File tree

7 files changed

+63
-189
lines changed

7 files changed

+63
-189
lines changed

.github/CONTRIBUTING.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
# Contributing to SpanExtensions.Net
2-
2+
33
### Did you catch a bug?
44

55
**!!!Important!!!**
6-
If the bug poses a threat to the security of dependent applications, please refer to our [Security Policy](SECURITY.md).
6+
If the bug poses a threat to the security of dependent applications, please refer to our [Security Policy](SECURITY.md).
77

88
There are two options available:
99

10-
1. You can open an issue describing exactly:
11-
- What is the bug and what did you expect to happen?
12-
- How may it be reproduced (It is often helpful to include images or alike).
13-
- Include the Version of SpanExtensions.Net affected.
14-
2. Even better, you can fix the issue yourself by submitting a pull reqest.
10+
1. You can open an issue describing exactly:
11+
- What the bug is and what you expected to happen?
12+
- How it may be reproduced (It is often helpful to include images or alike).
13+
- hich versions of SpanExtensions.Net affected.
14+
2. Even better, fix any issue yourself by submitting a pull request.
1515

1616
### Do you have a feature request?
1717

1818
Tell us all about it (here)[]. Please consider however, that features should generally be implementable via Extension Methods, otherwise they are unlikely to be accepted.
1919

20-
### Did you notice a mistake or an error in the documentation?
20+
### Did you notice a mistake or an error in the documentation?
2121

22-
If you found a spelling mistake or an ambigous or unclear sentence or phrase in the XML documentation in C# source files or in any of the documentation for this repository (for example: Readme.md), do one of the following:
22+
If you found a spelling mistake or an ambigous or unclear sentence or phrase in the XML documentation in C# source files or in any of the documentation for this repository (for example: Readme.md), do one of the following:
2323

24-
[Open an **Issue**](https://github.com/draconware-dev/SpanExtensions.Net/issues/new/choose) with the tag `documentation`. It is recommended to follow the [example template](https://github.com/draconware-dev/SpanExtensions.Net/issues/new?assignees=&labels=documentation&projects=&template=documentation-report.md&title=Documentation+Error).
24+
[Open an **Issue**](https://github.com/draconware-dev/SpanExtensions.Net/issues/new/choose) with the tag `documentation`. It is recommended to follow the [example template](https://github.com/draconware-dev/SpanExtensions.Net/issues/new?assignees=&labels=documentation&projects=&template=documentation-report.md&title=Documentation+Error).
2525

2626
**OR**
2727

28-
[Open a **Pull Request**](https://github.com/draconware-dev/SpanExtensions.Net/compare) linked to an **Issue** tagged `documentation`, as grammatical errors are usually easier to fix, than they are to describe. In this case it is not necessary to describe the error in detail, a brief report with reasoning should do, unless it is not evident from the Pull Request, what actually was changed or why it was changed.
28+
[Open a **Pull Request**](https://github.com/draconware-dev/SpanExtensions.Net/compare) linked to an **Issue** tagged `documentation`, as grammatical errors are usually easier to fix, than they are to describe. In this case it is not necessary to describe the error in detail, a brief report with reasoning should do, unless it is not evident from the Pull Request, what actually was changed or why it was changed.

.github/README.md

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,17 @@
55
[![GitHub License](https://img.shields.io/github/license/draconware-dev/SpanExtensions.Net)](https://github.com/draconware-dev/SpanExtensions.Net/blob/main/LICENSE)
66

77
## About
8-
**`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.
98

10-
**SpanExtensions.Net** aims to help developers use `ReadonlySpan<T>` and `Span<T>` more **productively**, **efficiently** and **safely** and write overall more **performant** Programs.
11-
12-
Never again switch back to using `string` instead of `ReadonlySpan<T>`, just because the method you seek is not supported.
13-
14-
**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()`.
9+
Never again switch back to using `string` instead of `ReadonlySpan<T>`, just because the method you seek is not supported.
1510

16-
## Methods
17-
The following **Extension Methods** are contained:
18-
19-
#### String Methods made available for **`ReadonlySpan<T>`** and **`Span<T>`**:
20-
21-
- `(ReadOnly-)Span<T>.Split(T delimiter)`
22-
- `(ReadOnly-)Span<T>.Split(T delimiter, int count)`
23-
- `(ReadOnly-)Span<T>.Split(T delimiter, StringSplitOptions options)`
24-
- `(ReadOnly-)Span<T>.Split(T delimiter, StringSplitOptions options, int count)`
25-
- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters)`
26-
- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters, int count)`
27-
- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters, StringSplitOptions options)`
28-
- `(ReadOnly-)Span<T>.Split(ReadOnlySpan<T> delimiters, StringSplitOptions options, int count)`
29-
- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters)`
30-
- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters, int count)`
31-
- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters, StringSplitOptions options)`
32-
- `(ReadOnly-)Span<T>.SplitAny(ReadOnlySpan<T> delimiters, StringSplitOptions options, int count)`
33-
- `(ReadOnly-)Span<T>.Remove(int startIndex)`
34-
- `Span<T>.Replace(T oldT, T newT)`
35-
36-
#### Linq Methods made available for **`ReadonlySpan<T>`** and **`Span<T>`**:
37-
38-
- `(ReadOnly-)Span<T>.All(Predicate<T> predicate)`
39-
- `(ReadOnly-)Span<T>.Any(Predicate<T> predicate)`
40-
- `(ReadOnly-)Span<T>.Average()`
41-
- `(ReadOnly-)Span<T>.Sum()`
42-
- `(ReadOnly-)Span<T>.Skip(int count)`
43-
- `(ReadOnly-)Span<T>.Take(int count)`
44-
- `(ReadOnly-)Span<T>.SkipLast(int count)`
45-
- `(ReadOnly-)Span<T>.Takelast(int count)`
46-
- `(ReadOnly-)Span<T>.SkipWhile(Predicate<T> condition)`
47-
- `(ReadOnly-)Span<T>.TakeWhile(Predicate<T> condition)`
48-
- `(Readonly-)Span<T>.First()`
49-
- `(Readonly-)Span<T>.First(Predicate<T> predicate)`
50-
- `(Readonly-)Span<T>.FirstOrDefault()`
51-
- `(Readonly-)Span<T>.FirstOrDefault(Predicate<T> predicate)`
52-
- `(Readonly-)Span<T>.FirstOrDefault(T defaultValue)`
53-
- `(Readonly-)Span<T>.FirstOrDefault(Predicate<T> predicate, T defaultValue)`
54-
- `(Readonly-)Span<T>.Last()`
55-
- `(Readonly-)Span<T>.Last(Predicate<T> predicate)`
56-
- `(Readonly-)Span<T>.LastOrDefault()`
57-
- `(Readonly-)Span<T>.LastOrDefault(Predicate<T> predicate)`
58-
- `(Readonly-)Span<T>.LastOrDefault(T defaultValue)`
59-
- `(Readonly-)Span<T>.LastOrDefault(Predicate<T> predicate, T defaultValue)`
60-
- `(Readonly-)Span<T>.Single()`
61-
- `(Readonly-)Span<T>.Single(Predicate<T> predicate)`
62-
- `(Readonly-)Span<T>.SingleOrDefault()`
63-
- `(Readonly-)Span<T>.SingleOrDefault(Predicate<T> predicate)`
64-
- `(Readonly-)Span<T>.SingleOrDefault(T defaultValue)`
65-
- `(Readonly-)Span<T>.SingleOrDefault(Predicate<T> predicate, T defaultValue)`
66-
- `(Readonly-)Span<T>.ElementAt(int index)`
67-
- `(Readonly-)Span<T>.ElementAt(Index index)`
68-
- `(Readonly-)Span<T>.ElementAtOrDefault(int index)`
69-
- `(Readonly-)Span<T>.ElementAtOrDefault(Index index)`
70-
- `(Readonly-)Span<T>.ElementAtOrDefault(int index, T defaultValue)`
71-
- `(Readonly-)Span<T>.ElementAtOrDefault(Index index, T defaultValue)`
72-
- `(Readonly-)Span<T>.Min()`
73-
- `(Readonly-)Span<T>.Min(Func<TSource, TResult> selector)`
74-
- `(Readonly-)Span<T>.MinBy(Func<TSource, TKey> keySelector)`
75-
- `(Readonly-)Span<T>.MinBy(Func<TSource, TKey> keySelector, IComparer<TKey> comparer)`
76-
- `(Readonly-)Span<T>.Max()`
77-
- `(Readonly-)Span<T>.Max(Func<TSource, TResult> selector)`
78-
- `(Readonly-)Span<T>.MaxBy(Func<TSource, TKey> keySelector)`
79-
- `(Readonly-)Span<T>.MaxBy(Func<TSource, TKey> keySelector, IComparer<TKey> comparer)`
11+
**SpanExtensions.Net** aims to help developers use `ReadonlySpan<T>` and `Span<T>` more **productively**, **efficiently** and **safely** and write overall more **performant** Programs.
8012

8113
## Contributing
8214

8315
Thank you for your interest in contributing to this project - Please see [Contributing](CONTRIBUTING.md)!
16+
8417
## License
8518

86-
Copyright (c) draconware-dev. All rights reserved.
19+
Copyright (c) draconware-dev. All rights reserved.
8720

8821
Licensed under the [MIT](../LICENSE) License.

.github/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
If you find a security vulnerability please message **[email protected]** about the vulnerability and do not, **under no circumstances**, open a public issue.
5+
If you find a security vulnerability please message **[email protected]** about the vulnerability and do not, **under no circumstances**, open a public issue.

Changelog.md

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@
33
All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6-
and this project adheres not (yet) to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) from v2.0 onwards.
7+
8+
## [2.0.0] - 2025-9-28
9+
10+
### Fixed
11+
12+
- an empty array not being treated as whitespace by range-based Split methods (https://github.com/draconware-dev/SpanExtensions.Net/pull/27)
13+
- the SearchValues-overload of range-based Split methods.
14+
15+
### Changed
16+
17+
- vectorized `Min()` and `Max()`.
18+
- transitioned to semantic versioning.
719

820
## [1.5.1] - 2024-12-14
921

1022
### Fixed
1123

1224
- incorrect ranges returned by the range-based Split method for versions prior to .Net 9.
1325

14-
### Changed
26+
### Changed
1527

1628
- moved MemoryExtensions containing range-based Split method for versions prior to .Net 9 from `System` to `SpanExtensions`.
1729
- grammatical issues in some documentation comments.
@@ -22,49 +34,49 @@ and this project adheres not (yet) to [Semantic Versioning](https://semver.org/s
2234

2335
- implementations of the newly introduced Span.Split methods from .Net 9 for any version prior to .Net 9 to maintain backwards-compatibility across .Net versions.
2436

25-
### Changed
37+
### Changed
2638

2739
- Split extension methods to refer to new split implementations compatible to the ones in .Net 9 and made .Net 9 split methods the default from that version onwards. The original split methods are still accessible as static methods.
2840
- original Split methods are no longer available without passing span as a parameter.
2941

3042
## [1.4.2] - 2024-10-29
3143

32-
### Added
44+
### Added
3345

3446
- `(Readonly-)Span<T>.Count(...)` overloads to all versions before .Net 8 matching these introduced in .Net 8.
3547

36-
### Changed
48+
### Changed
3749

38-
- blocked compilation on .Net 9 due to known incompatibilities, which are to be resolved in version 1.5.
50+
- blocked compilation on .Net 9 due to known incompatibilities, which are to be resolved in version 1.5.
3951

4052
## [1.4.1] - 2024-9-9
4153

42-
### Fixed
54+
### Fixed
4355

4456
- a collision between the `Span<T>.Replace` method provided by SpanExtensions and the one newly provided by .Net 8.
4557

4658
## [1.4] - 2024-9-3
4759

48-
### Added
60+
### Added
4961

5062
- `(Readonly-)Span<T>.Count()`
5163
- `(Readonly-)Span<T>.Count(Predicate<T> predicate)`
5264

53-
### Changed
65+
### Changed
5466

5567
- `Split` to throw an `ArgumentException` instead of an `InvalidCountExceedingBehaviourException`
5668

57-
### Removed
69+
### Removed
5870

5971
- `InvalidCountExceedingBehaviourException`
6072

61-
### Fixed
73+
### Fixed
6274

63-
- various issues with `Split` (https://github.com/draconware-dev/SpanExtensions.Net/pull/11)
75+
- various issues with `Split` (https://github.com/draconware-dev/SpanExtensions.Net/pull/11)
6476

6577
## [1.3] - 2024-3-19
6678

67-
### Added
79+
### Added
6880

6981
- Compatibility with **.Net 8**
7082
- `(Readonly-)Span<T>.First()`
@@ -102,42 +114,42 @@ and this project adheres not (yet) to [Semantic Versioning](https://semver.org/s
102114
- nuget badge to README (https://github.com/draconware-dev/SpanExtensions.Net/pull/12)
103115
- `CountExceedingBehaviour`, which is passed to Split, defining how to properly handle its remaining elements.
104116

105-
### Changed
117+
### Changed
106118

107119
- documentation comments to better reflect the dotnet style (https://github.com/draconware-dev/SpanExtensions.Net/pull/8)
108120
- swapped order of `count` and `stringSplitOptions arguments` in `Split` methods.
109121
- renamed argument `span` in `Split` methods to `source`.
110122

111-
### Fixed
123+
### Fixed
112124

113125
- empty spans being ignored if they are the last element to be returned from `Split` and are therefore not returned. (https://github.com/draconware-dev/SpanExtensions.Net/pull/10)
114126

115127
## [1.2.1] - 2024-1-25
116128

117-
### Fixed
129+
### Fixed
118130

119131
- Ambiguous Extension Methods (https://github.com/draconware-dev/SpanExtensions.Net/issues/6)
120-
- Correctness of some documentation comments
132+
- Correctness of some documentation comments
121133

122134
## [1.2.0] - 2023-12-28
123135

124-
### Added
136+
### Added
125137

126138
- Missing documentation comments
127139

128-
### Fixed
140+
### Fixed
129141

130142
- Grammatical issues in some documentation comments
131143

132-
### Changed
144+
### Changed
133145

134-
- moved custom Enumerators into `SpanExtensions.Enumerators`
146+
- moved custom Enumerators into `SpanExtensions.Enumerators`
135147
- declared every `GetEnumerator` method in a ref struct as `readonly`
136-
- renamed the source ReadOnlySpan<T> in 10 out of 12 custom Enumerators from *span* to *source*
148+
- renamed the source ReadOnlySpan<T> in 10 out of 12 custom Enumerators from _span_ to _source_
137149

138150
## [1.1.0] - 2023-11-4
139151

140-
### Added
152+
### Added
141153

142154
- Compatibility with **.Net 6**
143155
- Compatibility with **.Net 5**
@@ -149,7 +161,7 @@ and this project adheres not (yet) to [Semantic Versioning](https://semver.org/s
149161
- Missing documentation comments
150162
- Changelog
151163

152-
### Fixed
164+
### Fixed
153165

154166
- Grammatical issues in some documentation comments
155167
- Broken link to the repository on nuget ([#3](https://github.com/draconware-dev/SpanExtensions.Net/pull/3))

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 draconware-dev
3+
Copyright (c) 2025 draconware-dev
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/README.md

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,17 @@
11
# SpanExtensions
22

33
## 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)`
314

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.
336

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.
788

799
## Contributing
8010

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+
8213
## License
8314

84-
Copyright (c) draconware-dev. All rights reserved.
15+
Copyright (c) draconware-dev. All rights reserved.
8516

8617
Licensed under the [MIT](https://github.com/draconware-dev/SpanExtensions.Net/blob/main/LICENSE) license.

0 commit comments

Comments
 (0)