MoreLinq
Pad<(Of <(<'TSource>)>)> Method (source, width, paddingSelector)
NamespacesMoreLinqMoreEnumerablePad<(Of <<'(TSource>)>>)(IEnumerable<(Of <<'(TSource>)>>), Int32, Func<(Of <<'(Int32, TSource>)>>))
Pads a sequence with a dynamic filler value if it is narrower (shorter in length) than a given width.
Declaration Syntax
C#Visual BasicVisual C++
public static IEnumerable<TSource> Pad<TSource>(
	this IEnumerable<TSource> source,
	int width,
	Func<int, TSource> paddingSelector
)
<ExtensionAttribute> _
Public Shared Function Pad(Of TSource) ( _
	source As IEnumerable(Of TSource), _
	width As Integer, _
	paddingSelector As Func(Of Integer, TSource) _
) As IEnumerable(Of TSource)
public:
[ExtensionAttribute]
generic<typename TSource>
static IEnumerable<TSource>^ Pad(
	IEnumerable<TSource>^ source, 
	int width, 
	Func<int, TSource>^ paddingSelector
)
Generic Template Parameters
TSource
The type of the elements of source.
Parameters
source (IEnumerable<(Of <(<'TSource>)>)>)
The sequence to pad.
width (Int32)
The width/length below which to pad.
paddingSelector (Func<(Of <(<'Int32, TSource>)>)>)
Function to calculate padding.
Return Value
Returns a sequence that is at least as wide/long as the width/length specified by the width parameter.
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.
Examples
 Copy imageCopy
int[] numbers = { 0, 1, 2 };
IEnumerable<int> result = numbers.Pad(5, i => -i);
The result variable, when iterated over, will yield 0, 1, 2, -3 and -4, in turn.

Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)