Extensions.ToEnumerable 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.
Overloads
| Name | Description |
|---|---|
| ToEnumerable(IIterable) |
Returns an IEnumerable that iterates over a Java
IIterable, allowing |
| ToEnumerable<T>(IIterable) |
Returns an IEnumerable<T> that iterates over a Java
IIterable, marshaling each element to |
ToEnumerable(IIterable)
Returns an IEnumerable that iterates over a Java
IIterable, allowing foreach to be used with Java
collection types. Each element is marshaled from its Java instance to the corresponding
managed type.
public static System.Collections.IEnumerable ToEnumerable(this Java.Lang.IIterable source);
static member ToEnumerable : Java.Lang.IIterable -> System.Collections.IEnumerable
Parameters
Returns
An IEnumerable over the elements of source.
Exceptions
source is null. The exception is thrown when an enumerator
for the returned sequence is first advanced.
Remarks
To use LINQ operators that require a generic sequence, first use Cast<TResult> or OfType<TResult> on the returned sequence, or use ToEnumerable<T>(IIterable).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
ToEnumerable<T>(IIterable)
Returns an IEnumerable<T> that iterates over a Java
IIterable, marshaling each element to T. This
allows foreach and LINQ to be used with Java collection types.
public static System.Collections.Generic.IEnumerable<T?> ToEnumerable<T>(this Java.Lang.IIterable source);
static member ToEnumerable : Java.Lang.IIterable -> seq<'T>
Type Parameters
- T
The managed type to marshal each Java element to.
Parameters
Returns
An IEnumerable<T> over the elements of source.
Exceptions
source is null. The exception is thrown when an enumerator
for the returned sequence is first advanced.
Remarks
A Java null element is returned as default(T). For a non-nullable value type, this is the default value of that type.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.