c# - How to get buttons with specifications from an array list -
i have array:
button[] rightarr = new button[12] { button13, button14, button15, button16, button17, button18, button19, button20, button21, button22, button23, button24, };
i want check if there 4 greenish backcolor buttons , if there something, example: messagebox.show("there 4 greenish buttons");
how can that?
you can utilize linq this. have assumed, greenish buttons = buttons backcolor green. sense free alter that.
var greenbtns = (from m in rightarr m.backcolor == color.green select m).tolist(); if (greenbtns.count >= 4) { messagebox.show("there 4 greenish buttons"); }
c#
No comments:
Post a Comment