xtd 0.2.0
Loading...
Searching...
No Matches
enumerable_to_list.cpp

Shows how to use xtd::linq::enumerable::to_list method.

#include <xtd/xtd>
auto main() -> int {
auto fruits = array<string> {"apple", "passionfruit", "banana", "mango", "orange", "blueberry", "grape", "strawberry"};
auto lengths = fruits.select<usize>(_*method(&string::length)).to_list();
for (auto length : lengths)
console::write_line(length);
}
// This code produces the following output :
//
// 5
// 12
// 6
// 5
// 6
// 9
// 5
// 10