Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个(int)maskfield,其中包含选择列表的选定值。 文档:MaskField 我有一个字符串数组,对应于 maskfield 的条目。
填充此掩码字段后,我想检索我们在数组中选择的选项。 我怎么能用这个 int 做到这一点?
我找到了怎么做:
ArrayList maGroupNames; // This is my array of options (string) int mCategory; // This is my maskfield's result for (int i = 0; i < maGroupNames.Count; i++) { int layer = 1 << i; if ((mCategory & layer) != 0) { //This group is selected } }