我刚刚开始学习Observable
和所有它的变化并遇到一些奇怪的问题。这里是:
我有一个 WCF 服务声明(在“添加服务引用”过程之后):
public IAsyncResult ReceiveAllUsersAsync(AsyncCallback Callback, object State)
{
// Do some work
}
这里是闭幕词:
public IObservable<User> EndReceiveAllUsers(IAsyncResult AsyncResultHandler)
{
// Do some work (actuall y it's a: return AsyncResultHandler.EndInvoke();
// return IObservable<User>
}
正如你可以看到的返回EndReceiveAllUsers
集合User
接下来我像这样运行 RX:
// This will not owrk
Func<IObservable<User>> callWcfService = Observable.FromAsyncPattern<IObservable<User>>(BeginReceiveAll, EndReceiveAll);
// Actuall Func<> signature is:
Func<IObservable< IObservable<User> >> callWcfService = Observable.FromAsyncPattern<IObservable<User>>(BeginReceiveAll, EndReceiveAll);
但问题是从返回的任何内容Observable.FromAsyncPattern
都是. 实际上它返回。我如何只返回一个结果而不是结果集合IObservable<>
IObservable<User>
IObservable< IObservable<User> >
IObservable<User>