D equivalent for LINQ Where
monkyyy
crazymonkyyy at gmail.com
Fri May 2 16:32:23 UTC 2025
On Friday, 2 May 2025 at 14:32:04 UTC, Python wrote:
> I am trying to get some items from a list, but `find` gives me
> unexpected results.
>
> ```
> import std.stdio;
> import std.algorithm;
>
> int[] x = [1, 2, 3, 4, 5, 1, 2, 3];
>
> void main()
> {
> auto selection = x.find!(a => a == 2);
>
> foreach(item;selection)
> {
> writeln(item);
> }
> }
> ```
>
> Output is 2, 3, 4, 5, 1, 2, 3
>
> Basically, I am looking for Where from C#.
https://hoogletranslate.com
I confirm, its filter
Find, drops until it finds the filter or element
More information about the Digitalmars-d-learn
mailing list