如何存储代表在名单 [英] How to store delegates in a List

查看:148
本文介绍了如何存储代表在名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何保存委托(姓名的匿名,拉姆达)的一个泛型列表?基本上我试图从建立一个委托字典,我可以用一键访问存储的代表和执行它并返回需求的价值。是否有可能做的C#4?任何想法来完成它? 注:异构名单是preferable在那里我可以存储任何类型的代表。

How can I store delegates (named, anonymous, lambda) in a generic list? Basically I am trying to build a delegate dictionary from where I can access a stored delegate using a key and execute it and return the value on demand. Is it possible to do in C# 4? Any idea to accomplish it? Note : Heterogeneous list is preferable where I can store any kind of delegates.

推荐答案

确实 System.Collections.Generic.Dictionary<字符串,System.Delegate> 不足以

这篇关于如何存储代表在名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆