CommunityToolkit / CommunityToolkit/dotnet

Guard add support System.Collections.Immutable

Open
#414 1 comment 1 reaction 0 assignees View on GitHub
feature request :mailbox_with_mail:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Overview

Guard IsNotEmpty not support ImmutableArray

### API breakdown

```csharp
namespace CommunityToolkit.Diagnostics;

partial class Guard
{
public static void IsNotEmpty(ImmutableArray collection, [CallerArgumentExpression("collection")] string name = "")
public static void IsNotEmpty(ImmutableHashSet collection, [CallerArgumentExpression("collection")] string name = "")
public static void IsNotEmpty(ImmutableList collection, [CallerArgumentExpression("collection")] string name = "")
public static void IsNotEmpty(ImmutableQueue collection, [CallerArgumentExpression("collection")] string name = "")
public static void IsNotEmpty(ImmutableSortedSet collection, [CallerArgumentExpression("collection")] string name = "")
public static void IsNotEmpty(ImmutableStack collection, [CallerArgumentExpression("collection")] string name = "")

public static void IsNotEmpty(ImmutableDictionary collection,
[CallerArgumentExpression("collection")] string name = "") where TKey : notnull
}
public static void IsNotEmpty(ImmutableSortedDictionary collection,
[CallerArgumentExpression("collection")] string name = "") where TKey : notnull
}
```

### Usage example

```csharp
using CommunityToolkit.Diagnostics;

public class Foo
{
public void Test(ImmutableArray values)
{
Guard.IsNotEmpty(values);
}
}
```

### Breaking change?

No

### Alternatives

no

### Additional context

_No response_

### Help us help you

Yes, I'd like to be assigned to work on this item

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.