Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Ramstack.Structures

Ramstack.Structures is a .NET library providing various data structures and utilities.
[![NuGet](https://img.shields.io/nuget/v/Ramstack.Structures.svg)](https://nuget.org/packages/Ramstack.Structures)
[![MIT](https://img.shields.io/github/license/rameel/ramstack.structures)](https://github.com/rameel/ramstack.structures/blob/main/LICENSE)

[![.NET](https://github.com/rameel/ramstack.structures/actions/workflows/test.yml/badge.svg)](https://github.com/rameel/ramstack.structures/actions/workflows/test.yml)
Ramstack.Structures is a .NET library providing various data structures and utilities.

## Installation

Expand Down Expand Up @@ -47,14 +48,20 @@ foreach (ref readonly HeavyStruct s in view)
```
## Changelog

### 1.2.2
- Optimize `ArrayView.Create` method for empty collection expression

### 1.2.1
- Add `List<T>` to `ArrayView<T>` extension for NET9.0+

### 1.2.0
- Add `Trim` overloads to `StringView` class

## Supported versions

| | Version |
|------|---------|
| .NET | 6, 7, 8 |
| | Version |
|------|------------|
| .NET | 6, 7, 8, 9 |

## Contributions

Expand Down
6 changes: 4 additions & 2 deletions Ramstack.Structures/Collections/ArrayView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public static ArrayView<T> Create<T>(params T[] items) =>
/// <returns>
/// An <see cref="ArrayView{T}"/> instance for the specified read-only span.
/// </returns>
public static ArrayView<T> Create<T>(ReadOnlySpan<T> items) =>
new(items.ToArray());
public static ArrayView<T> Create<T>(params ReadOnlySpan<T> items) =>
items.Length != 0
? new ArrayView<T>(items.ToArray())
: ArrayView<T>.Empty;
}