Прочетете на английски Редактиране

Споделяне чрез


AsyncEnumerable.Repeat<TResult>(TResult, Int32) Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Generates a sequence that contains one repeated value.

C#
public static System.Collections.Generic.IAsyncEnumerable<TResult> Repeat<TResult>(TResult element, int count);

Type Parameters

TResult

The type of the value to be repeated in the result sequence.

Parameters

element
TResult

The value to be repeated.

count
Int32

The number of times to repeat the value in the generated sequence.

Returns

IAsyncEnumerable<TResult>

An IAsyncEnumerable<T> that contains a repeated value.

Exceptions

count is less than 0.

Applies to

Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided), 10
.NET Standard 2.0 (package-provided)