Prepends a single value to a sequence.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public static IEnumerable<TSource> Prepend<TSource>( this IEnumerable<TSource> source, TSource value )
<ExtensionAttribute> _ Public Shared Function Prepend(Of TSource) ( _ source As IEnumerable(Of TSource), _ value As TSource _ ) As IEnumerable(Of TSource)
public: [ExtensionAttribute] generic<typename TSource> static IEnumerable<TSource>^ Prepend( IEnumerable<TSource>^ source, TSource value )
Generic Template Parameters
- TSource
- The type of the elements of source.
Parameters
- source (IEnumerable<(Of <(<'TSource>)>)>)
- The sequence to prepend to.
- value (TSource)
- The value to prepend.
Return Value
Returns a sequence where a value is prepended to it.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<(Of <(<'TSource>)>)>. When you use instance method syntax to call this method, omit the first parameter.
Remarks
This operator uses deferred execution and streams its results.
Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)