refactor: remove IEnumerable.ConcatOne

This commit is contained in:
Oliver Booth 2023-05-14 16:27:42 +01:00
parent 23dee3d2b8
commit d8be858359
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61
2 changed files with 4 additions and 26 deletions

View File

@ -31,6 +31,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- X10D: `DateTime.Age(DateTime)` and `DateTimeOffset.Age(DateTimeOffset)` parameter renamed from `asOf` to `referenceDate`.
### Removed
- X10D: Removed `IEnumerable<T>.ConcatOne` - this functionality already exists with `Append`.
## [3.2.0] - 2023-04-03
### Added

View File

@ -9,32 +9,6 @@ namespace X10D.Linq;
/// </summary>
public static class EnumerableExtensions
{
/// <summary>
/// Concatenates a single value to the end of a sequence.
/// </summary>
/// <param name="source">The source sequence.</param>
/// <param name="value">The value to concatenate to the end of the source sequence.</param>
/// <typeparam name="TSource">The type of the elements in <paramref name="source" />.</typeparam>
/// <returns>
/// An <see cref="IEnumerable{T}" /> that contains the concatenated elements of the input sequence, and the specified
/// value.
/// </returns>
/// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception>
public static IEnumerable<TSource> ConcatOne<TSource>(this IEnumerable<TSource> source, TSource value)
{
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
foreach (TSource item in source)
{
yield return item;
}
yield return value;
}
/// <summary>
/// Filters a sequence of values by omitting elements that match a specified value.
/// </summary>