您的位置:首页 > 其它

Action、Action<T>、Func<T> 匿名函数的写法

2015-08-21 20:25 441 查看
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); });
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: