gpt4 book ai didi

c# - ActionCommand 和 DelegateCommand 有什么区别

转载 作者:行者123 更新时间:2023-12-03 10:37:16 26 4
gpt4 key购买 nike

如果有人能告诉我使用 Expression Blend 和 DelegateCommand 类(Prism)中的 ActionCommand 类有什么区别和好处,我将不胜感激?

如果我理解正确,DelegateCommand 支持两个委托(delegate),而 ActionCommand 类仅支持一个 Execute 委托(delegate)。还有其他区别吗?在阅读了文档和在线之后,我仍然不太明白使用任何一个都有什么好处。

提前致谢

最佳答案

委托(delegate)指挥允许委派命令逻辑,而不是在后面的代码中要求处理程序。它使用委托(delegate)作为调用目标处理方法的方法。

public class DelegateCommand<T> : ICommand
{
public DelegateCommand(Action<T> executeMethod, Func<T, bool> canExecuteMethod)
{

this.executeMethod = executeMethod;
this.canExecuteMethod = canExecuteMethod;

}

}

关于c# - ActionCommand 和 DelegateCommand 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22652221/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com