diff --git a/examples/xtd.core.examples/linq/enumerable_aggregate/src/enumerable_aggregate.cpp b/examples/xtd.core.examples/linq/enumerable_aggregate/src/enumerable_aggregate.cpp index fdaa958e91b..b96fea150aa 100644 --- a/examples/xtd.core.examples/linq/enumerable_aggregate/src/enumerable_aggregate.cpp +++ b/examples/xtd.core.examples/linq/enumerable_aggregate/src/enumerable_aggregate.cpp @@ -1,8 +1,7 @@ -#include #include +#include using namespace xtd; -using namespace xtd::linq; auto main() -> int { auto sentence = "the quick brown fox jumps over the lazy dog"_s; @@ -11,7 +10,7 @@ auto main() -> int { auto words = sentence.split(' '); // Prepend each word to the beginning of the new sentence to reverse the word order. - auto reversed = enumerable::aggregate(words, [](const string& working_sentence, const string& next) { + auto reversed = words.aggregate([](const string& working_sentence, const string& next) { return next + " " + working_sentence; }); diff --git a/examples/xtd.core.examples/linq/enumerable_aggregate2/src/enumerable_aggregate2.cpp b/examples/xtd.core.examples/linq/enumerable_aggregate2/src/enumerable_aggregate2.cpp index 1b7ec26c3d2..b1aa41fe683 100644 --- a/examples/xtd.core.examples/linq/enumerable_aggregate2/src/enumerable_aggregate2.cpp +++ b/examples/xtd.core.examples/linq/enumerable_aggregate2/src/enumerable_aggregate2.cpp @@ -1,15 +1,13 @@ -#include #include #include using namespace xtd; -using namespace xtd::linq; auto main() -> int { auto ints = array {4, 8, 8, 3, 9, 0, 7, 8, 2}; // Count the even numbers in the array, using a seed value of 0. - auto num_even = enumerable::aggregate(ints, 0, [](int total, int next) { + auto num_even = ints.aggregate(0, [](int total, int next) { return next % 2 == 0 ? total + 1 : total; }); diff --git a/examples/xtd.core.examples/linq/enumerable_aggregate3/src/enumerable_aggregate3.cpp b/examples/xtd.core.examples/linq/enumerable_aggregate3/src/enumerable_aggregate3.cpp index 54b5be4e122..a604715b5f6 100644 --- a/examples/xtd.core.examples/linq/enumerable_aggregate3/src/enumerable_aggregate3.cpp +++ b/examples/xtd.core.examples/linq/enumerable_aggregate3/src/enumerable_aggregate3.cpp @@ -1,16 +1,14 @@ -#include #include #include using namespace xtd; -using namespace xtd::linq; auto main() -> int { auto fruits = array {"apple"_s, "mango"_s, "orange"_s, "passionfruit"_s, "grape"_s}; // Determine whether any string in the array is longer than "banana". auto longest_name = - enumerable::aggregate(fruits, "bananas"_s, + fruits.aggregate("bananas"_s, [](const string& longest, const string& next) {return next.length() > longest.length() ? next : longest;}, // Return the final result as an upper case string. [](const string& fruit) {return fruit.to_upper();}); diff --git a/examples/xtd.core.examples/linq/enumerable_all/src/enumerable_all.cpp b/examples/xtd.core.examples/linq/enumerable_all/src/enumerable_all.cpp index ffff1ccb9f8..9aff2d3bc85 100644 --- a/examples/xtd.core.examples/linq/enumerable_all/src/enumerable_all.cpp +++ b/examples/xtd.core.examples/linq/enumerable_all/src/enumerable_all.cpp @@ -1,8 +1,7 @@ -#include +#include #include using namespace xtd; -using namespace xtd::linq; auto main() -> int { struct pet : public object { @@ -21,7 +20,7 @@ auto main() -> int { }; // Determine whether all pet names in the array start with 'B'. - bool all_start_with_b = enumerable::all(pets, [](const pet& pet) { + bool all_start_with_b = pets.all([](const pet& pet) { return pet.name.starts_with("B"); }); diff --git a/examples/xtd.core.examples/linq/enumerable_any/src/enumerable_any.cpp b/examples/xtd.core.examples/linq/enumerable_any/src/enumerable_any.cpp index 493b16073e7..11210ac54a2 100644 --- a/examples/xtd.core.examples/linq/enumerable_any/src/enumerable_any.cpp +++ b/examples/xtd.core.examples/linq/enumerable_any/src/enumerable_any.cpp @@ -1,14 +1,12 @@ #include -#include #include using namespace xtd; using namespace xtd::collections::generic; -using namespace xtd::linq; auto main() -> int { auto numbers = list {1, 2}; - auto has_elements = enumerable::any(numbers); + auto has_elements = numbers.any(); console::write_line("The list {0} empty.", has_elements ? "is not" : "is"); } diff --git a/examples/xtd.core.examples/linq/enumerable_any2/src/enumerable_any2.cpp b/examples/xtd.core.examples/linq/enumerable_any2/src/enumerable_any2.cpp index b2a07cb56d8..17294bd38fa 100644 --- a/examples/xtd.core.examples/linq/enumerable_any2/src/enumerable_any2.cpp +++ b/examples/xtd.core.examples/linq/enumerable_any2/src/enumerable_any2.cpp @@ -1,8 +1,7 @@ -#include +#include #include using namespace xtd; -using namespace xtd::linq; auto main() -> int { struct pet : public object { @@ -22,7 +21,7 @@ auto main() -> int { }; // Determine whether all pet names in the array start with 'B'. - bool unvaccinated = enumerable::any(pets, [](const pet& pet) { + bool unvaccinated = pets.any([](const pet& pet) { return pet.age > 1 && !pet.vaccinated; });