How do I restate this as a lambda?

I don't know how to combine a list, a foreach and a lambda. Here is my code:

public void FillViewChunks(byte SetID, byte TexID, UInt32 Bits) { //NB we don't fill the hull, just the actual viewable/editable chunks foreach (Chunk Chunk in Chunks) { if (IsViewable(Chunk)) Chunk.Fill(SetID, TexID, Block.TETBITSALL); } } 

What I'd like to do is restate this as a lambda, something like:

ForEach(Chunk Chunk in Chunks) where (i=>IsViewable(i)) { Chunk.Fill(SetID, TexID, Block.TETBITSALL); } 

But I can't figure out the right syntax even though I've looked online.

by someguysaid via /r/csharp

Leave a Reply