We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
看看 Action Delegate
除此之外,您可能还想实现一个
IAction
界面 使用DoAction
方法。所以,类似
和
Have a look at Action Delegate
Other than that, you might want to implement an
IAction
interface with aDoAction
Method.So, something like
and
将每个方法公开为单独的方法似乎更自然,如下所示:
这将按如下方式使用:
该代码非常可读。
但是,如果您确实有兴趣通过一种方法完成所有操作,那么枚举值就足够了:
It seems more natural to expose each of these as a separate method, as in:
This would be used as follows:
That code is very readable.
However, if you're really interested in doing it all from one method, then an enumerated value can suffice: