/// <summary> /// Creates a buffered memory set. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="set">The set.</param> /// <returns></returns> public static async Task <Memory.Set <T> > ToMemorySetAsync <T>(this ISet <T> set, CancellationToken cancellationToken = default) { var memorySet = new Memory.Set <T>(); await foreach (var item in set.AsEnumerableAsync(cancellationToken).ConfigureAwait(false)) { await memorySet.AddAsync(item, cancellationToken); } return(memorySet); }