在 API 中使用 ReactiveCollection 是否合适?
在 API 中公开 ReactiveCollection 是否合适?具体来说,在将在多个应用程序内部使用的服务类中。但作为一个思想实验,我们也可以考虑在公共使用中。
我一直在研究 Rx 和 ReactiveUI,这些看起来都是强大的工具。但是,我没有足够的经验来确定要求其他人依赖它们是否是一个好主意。
更多详细信息:
我正在创建一个跟踪服务类来跟踪连接的客户端。在我看来,消费者使用此类所需要做的就是公开一个可观察的集合(可能是 ReactiveCollection),该集合公开连接的客户端,并通知由服务管理的集合的更改。代表连接的客户端的实体还将利用 INotifyPropertyChanged 来通知客户端状态的更新。
Is it appropriate to expose a ReactiveCollection in an API? Specifically, in a service class that would be used internally on multiple applications. But as a thought experiment, we can also consider in public use as well.
I've been investigating Rx and ReactiveUI, and these seem like powerful tools. However, I don't have enough experience with them to determine if it is a good idea to require others to take a dependency on them.
More details:
I'm creating a tracking service class that would track connected clients. From my view, all that would be necessary for consumers to use this class is to expose an observable collection (possibly a ReactiveCollection) that exposes the connected clients, and notifies of changes to the collection which are managed by the service. The entitity representing the connected clients would also take advantage of INotifyPropertyChanged to notify of updates to the clients' state.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 ReactiveCollection 是 .NET 的 ObservableCollection(即非 Rx WPF/SL 的)的衍生产品,因此您可以将其公开为 ObservableCollection。
Since ReactiveCollection is a derivative of .NET's ObservableCollection (i.e. the non-Rx WPF/SL one), you could expose it as an ObservableCollection instead.