标签:
void ht_HLB_Set(Dictionary<int, int> dic) { //匿名函数 Action<int> fun = (int jhShare_Iid) => { try { switch (dic[jhShare_Iid]) { case 0: s.Color = GradientButtons.ColorEnum.red; break; case 1: s.Color = GradientButtons.ColorEnum.blue; break; case 2: s.Color = GradientButtons.ColorEnum.white; break; } } catch { }; }; //设置计划员按钮颜色 this.li_btnJHY.ForEach(s => { fun((s.Value as rgjh_jhy_Models).jhShare_Iid); }); this.li_btnSC.ForEach(s => { fun((s.Value as rgjh_jhy_Models).jhShare_Iid); }); }
Action、Action<T>、Func<T> 匿名函数的写法
标签:
原文地址:http://www.cnblogs.com/chengulv/p/4748950.html