TryGetLast()

System::Collections::Generic::Details::TryGetLast(IEnumerable<T>&, bool&) function

Tries to get the last element of the collection.

template<typename T> T System::Collections::Generic::Details::TryGetLast(IEnumerable<T> &enumerable, bool &found)

Template parameters

ParameterDescription
TThe type of the collection elements.

Arguments

ParameterTypeDescription
enumerableIEnumerable<T>&The collection from which an element is to be acquired.
foundbool&The output parameter. Returns true when the collection contains any element. Otherwise false is returned.

Return Value

Returns the last collection element. The default value of the type will be returned when the collection is empty.

See Also