开发者

Check if any object in a 2d array is null

开发者 https://www.devze.com 2022-12-25 08:20 出处:网络
I\'ve got an array var cells = new Cell[w, h], can I loop through all cells without a nested for-loop (I want to check if at least one is null开发者_运维问答)? Ideally I\'d want to write something lik

I've got an array var cells = new Cell[w, h], can I loop through all cells without a nested for-loop (I want to check if at least one is null开发者_运维问答)? Ideally I'd want to write something like Debug.Assert(!cells.Contains(null)).


foreach loop ?

foreach (var item in cells)
{
    //code
}
0

精彩评论

暂无评论...
验证码 换一张
取 消