ฉันมีอินเตอร์เฟซที่เขียนแบบนี้:
public interface IItemRetriever
{
    public IAsyncEnumerable<string> GetItemsAsync();
}
ฉันต้องการเขียนการใช้งานเปล่า ๆ ที่ไม่มีรายการคืนมาเช่น:
public class EmptyItemRetriever : IItemRetriever
{
    public IAsyncEnumerable<string> GetItemsAsync()
    {
       // What do I put here if nothing is to be done?
    }
}
หากเป็น IEnumerable ธรรมดาฉันจะreturn Enumerable.Empty<string>();แต่ฉันไม่พบอะไรAsyncEnumerable.Empty<string>()เลย
วิธีการแก้ปัญหา
ฉันพบสิ่งนี้ซึ่งใช้งานได้ แต่ค่อนข้างแปลก:
public async IAsyncEnumerable<string> GetItemsAsync()
{
    await Task.CompletedTask;
    yield break;
}
ความคิดใด ๆ