Consider supporting collection literals for IAsyncEnumerable<T>

Open
#111,715 42 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
api

Research direction

Start with the API Proposal in this issue and the referenced discussion from PR #111685; no source file or test entry point is named. Clarify the intended collection-literal semantics and acceptance criteria before identifying implementation and tests; done means the proposal is resolved and any agreed API behavior is covered.

Written by the indexing model from the issue text.

Description

api-needs-work area-System.Collections

For testing purposes, it'd be reasonable. I don't know how much value it would add beyond that. Maybe as a shorthand for Empty, as you allude to here with your comment placement.

Originally posted by @stephentoub in https://github.com/dotnet/runtime/pull/111685#discussion_r1925762324

API Proposal

namespace System.Collections.Generic;

+[CollectionBuilder(typeof(AsyncEnumerableExtensions), nameof(AsyncEnumerableExtensions.Create))]
public interface IAsyncEnumerable<T>;

+public static class AsyncEnumerableExtensions
+{
+    public static IAsyncEnumerable<T> Create(ReadOnlySpan<T> values);
+}
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.