Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 显然,如果没有实现,ReactiveCommand如何从ICommand派生?_C#_Reactiveui - Fatal编程技术网

C# 显然,如果没有实现,ReactiveCommand如何从ICommand派生?

C# 显然,如果没有实现,ReactiveCommand如何从ICommand派生?,c#,reactiveui,C#,Reactiveui,在ReactiveUI中,类ReactiveCommand来自接口ICommand。然而,它的公共API似乎没有实现Execute和CanExecute 这怎么可能呢?ReactiveCommand实现了ICommand,这意味着只有当您的变量键入为ICommand时,您才能访问这些成员: ReactiveCommand<Unit, Unit> command = ...; // compile error command.Execute(); // compiles fine

ReactiveUI
中,类
ReactiveCommand
来自接口
ICommand
。然而,它的公共API似乎没有实现
Execute
CanExecute


这怎么可能呢?

ReactiveCommand
实现了
ICommand
,这意味着只有当您的变量键入为
ICommand
时,您才能访问这些成员:

ReactiveCommand<Unit, Unit> command = ...;

// compile error
command.Execute();

// compiles fine
(command as ICommand).Execute();
ReactiveCommand=。。。;
//编译错误
command.Execute();
//编撰精良
(命令作为ICommand.Execute();

这是为了鼓励您不要使用它,因为反应式界面优越,但仍有助于与依赖于它的UI工具包(如WPF)集成。

ReactiveCommand
实现了
ICommand
,这意味着您只能在变量类型为
ICommand
时访问这些成员:

ReactiveCommand<Unit, Unit> command = ...;

// compile error
command.Execute();

// compiles fine
(command as ICommand).Execute();
ReactiveCommand=。。。;
//编译错误
command.Execute();
//编撰精良
(命令作为ICommand.Execute();

这是为了鼓励您不要使用它,因为反应式界面更优越,但仍有助于与依赖它的UI工具包(如WPF)的集成.

我从来不知道接口的显式实现不会出现在类API中。我从来不知道接口的显式实现不会出现在类API中。