IEnumerableExtensionsSplitIntoNumberOfElementsT(IEnumerableT, Int32, Boolean, T) Method
Splits the source IEnumerableT into secuences with the specified amount of elements.
Namespace: DevCase.Extensions.IEnumerableExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static IEnumerable<IEnumerable<T>> SplitIntoNumberOfElements<T>(
this IEnumerable<T> sender,
int amount,
bool fillEmpty,
T valueToFill = null
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function SplitIntoNumberOfElements(Of T) (
sender As IEnumerable(Of T),
amount As Integer,
fillEmpty As Boolean,
Optional valueToFill As T = Nothing
) As IEnumerable(Of IEnumerable(Of T))
Dim sender As IEnumerable(Of T)
Dim amount As Integer
Dim fillEmpty As Boolean
Dim valueToFill As T
Dim returnValue As IEnumerable(Of IEnumerable(Of T))
returnValue = sender.SplitIntoNumberOfElements(amount,
fillEmpty, valueToFill)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
generic<typename T>
static IEnumerable<IEnumerable<T>^>^ SplitIntoNumberOfElements(
IEnumerable<T>^ sender,
int amount,
bool fillEmpty,
T valueToFill = nullptr
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member SplitIntoNumberOfElements :
sender : IEnumerable<'T> *
amount : int *
fillEmpty : bool *
?valueToFill : 'T
(* Defaults:
let _valueToFill = defaultArg valueToFill null
*)
-> IEnumerable<IEnumerable<'T>>
No code example is currently available or this language may not be supported.
- sender IEnumerableT
-
The source collection.
- amount Int32
-
The target amount of elements.
- fillEmpty Boolean
-
If set to , generates empty elements to fill the last secuence's part amount.
- valueToFill T (Optional)
-
An optional value used to fill the last secuence's part amount.
- T
-
The type.
IEnumerableIEnumerableTIEnumerableT.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim mainCol As IEnumerable(Of Integer) = {1, 2, 3, 4, 5, 6, 7, 8, 9}
Dim splittedCols As IEnumerable(Of IEnumerable(Of Integer)) = mainCol.SplitIntoNumberOfElements(amount:=4, fillEmpty:=True, valueToFill:=0)
splittedCols.ToList.ForEach(Sub(col As IEnumerable(Of Integer))
Debug.WriteLine(String.Join(", ", col))
End Sub)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.