how to filter associative arrays with foreach ?

someone someone at somewhere.com
Mon Jun 21 03:59:10 UTC 2021


I often need to iterate through a filtered collection 
(associative array) as following:

```d
string strComputerIDunwanted = "WS2"; /// associative array key 
to exclude

foreach (strComputerID, udtComputer; udtComputers) { /// 
.remove!(a => a == strComputerIDunwanted) ... ?

    if (strComputerID != strComputerIDunwanted) {

       ...

    }

}
```

Is there a way to filter the collection at the foreach-level to 
avoid the inner if ?


More information about the Digitalmars-d-learn mailing list