Queryable.Prepend<TSource>(IQueryable<TSource>, TSource) 方法

定義

傳回新的可查詢序列,包含來自 source 的元素,並在開頭加上指定的 elementReturns a new queryable sequence that contains the elements from source plus the specified element prepended at the beginning.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<TSource> ^ Prepend(System::Linq::IQueryable<TSource> ^ source, TSource element);
public static System.Linq.IQueryable<TSource> Prepend<TSource> (this System.Linq.IQueryable<TSource> source, TSource element);
static member Prepend : System.Linq.IQueryable<'Source> * 'Source -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function Prepend(Of TSource) (source As IQueryable(Of TSource), element As TSource) As IQueryable(Of TSource)

類型參數

TSource

可查詢序列中元素的類型。The type of the elements in the queryable sequence.

參數

source
IQueryable<TSource>

可查詢的序列。A queryable sequence.

element
TSource

要在 source 前加上的 TSource 類型元素。An element of type TSource to prepend to source.

傳回

IQueryable<TSource>

新的可查詢序列,包含來自 source 的元素,並在開頭加上指定的 elementA new queryable sequence that contains the elements from source plus the specified element prepended at the beginning.

例外狀況

sourcenullsource is null.

適用於