C# 在RxUI 6中订阅ReactiveCommand的正确方式是什么?

C# 在RxUI 6中订阅ReactiveCommand的正确方式是什么?,c#,xamarin-studio,reactiveui,C#,Xamarin Studio,Reactiveui,我正在尝试使用ReactiveUI6(beta版)设置一个简单的骨架视图模型,并不断得到编译器错误(在XamarinStudio,FWIW) 代码: 使用系统; 使用系统。无功; 使用System.Reactive.Linq; 使用ReactiveUI; // ... 公共IReactiveCommand TryAuthenticateCommand{get;protected set;} // ... this.TryAuthenticateCommand=ReactiveCommand.Cr

我正在尝试使用ReactiveUI6(beta版)设置一个简单的骨架视图模型,并不断得到编译器错误(在XamarinStudio,FWIW)

代码:

使用系统;
使用系统。无功;
使用System.Reactive.Linq;
使用ReactiveUI;
// ...
公共IReactiveCommand TryAuthenticateCommand{get;protected set;}
// ...
this.TryAuthenticateCommand=ReactiveCommand.Create(
这是什么(
x=>x.用户名,
x=>x.密码,
(用户名、密码)=>
!string.IsNullOrWhiteSpace(username.Value)&&
!string.IsNullOrWhiteSpace(password.Value));
Subscribe(x=>MessageBus.Current.SendMessage(“Yes!”);
错误:

Error CS0411: The type arguments for method `System.ObservableExtensions.Subscribe<T>(this System.IObservable<T>, System.Action<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly (CS0411)
错误CS0411:无法从用法推断方法“System.ObservableExtensions.Subscribe(this System.IObservable,System.Action)”的类型参数。尝试显式指定类型参数(CS0411)

这段代码非常完美,我认为您只是缺少了一条using语句,“using System.Reactive”

更新:这不起作用的原因是代码段中没有代码。您将
tryaauthenticatecommand
声明为
IReactiveCommand
,该命令未实现
IObservable
(什么是
t


在本例中,由于没有提供异步方法,因此ReactiveCommand将返回CommandParameter,它是一个
对象。因此,将其声明为
ReactiveCommand
,一切正常

尝试使用System.Reactive添加
这没有什么区别。System.Reactive.Linq?我永远记不起那个扩展方法在哪里,它们都有(请参阅更新的问题)。还有其他的吗?:)你能寄给我一个小的复制项目吗?paul@paulbetts.orgThanks,这是有道理的。那么原型定义应该是什么样的呢?