score:5

Accepted answer

you can achieve this using linq:

double[] a = new double[]{1.0, 2.0, 3.0}; 
bool[] b = new bool[]{true, false, true}; 
var result = a.where((item, index)=>b[index]);

score:4

there's also this more traditional linq approach:

b.select((f, i) => f ? i : - 1).where(i => i != -1).select(i => a[i]);

score:6

use linq zip method, e.g.:

a.zip(b, (i, j) => new {i, j}).where(x => x.j).select(x => x.i)

Related Query

More Query from same tag