摘要:
场景: 根据选择区域,从集合中计算mask的值 public string GetSelectAgencyMask() { int mask = 0; int ert = 1; foreach (AgencyData aData in selectedAgencyList) { mask += (ert << (aData.AgencyMask - 1)); // 1 左移 mask - 1 位的值, 进行汇总 } return mask.ToString(); }例如所选的值分别为2,3, 4, 5 计算的结果是30(00011110). 阅读全文