简体   繁体   English

.NET 4.5中Java NIO的替代品是什么?

[英]What's the replacement for Java NIO in .NET 4.5?

As I studied NIO, one of its important features is its non-blocking behavior. 当我研究NIO时,其重要功能之一是其非阻塞行为。 Is it true that in .NET and C# the combinations of Async/Await and Streams brings that non-blocking feature of NIO into .NET? 在.NET和C#中,Async / Await和Streams的组合是否确实将NIO的非阻塞功能引入了.NET中?

Or is there any other good replacement in .NET 4.5? 还是.NET 4.5中有其他良好的替代品?

I found Any NIO frameworks for .NET? 我找到了用于.NET的任何NIO框架吗? question on SO but it's a 2009 question which there wasn't any Async/Await introduced yet. 有关SO的问题,但这是2009年的问题,尚未引入任何Async/Await

Apart from async/await , the other framework (well more of a extension) is the Rx Extensions (Reactive Extensions) 除了async/await ,其他框架(还有更多扩展)是Rx Extensions (反应性扩展)

Few Helpful links 很少有用的链接

Rx extension has little learning curve, but it can really ease up few works Rx扩展几乎没有学习曲线,但实际上可以简化一些工作

As described on the website 如网站上所述

The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Reactive Extensions(Rx)是一个库,用于使用可观察的序列和LINQ样式的查询运算符来组成异步和基于事件的程序。 Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. 使用Rx,开发人员可以用Observables表示异步数据流,使用LINQ运算符查询异步数据流,并使用Scheduler在异步数据流中参数化并发性。 Simply put, Rx = Observables + LINQ + Schedulers. 简而言之,Rx = Observables + LINQ + Scheduler。

Whether you are authoring a traditional desktop or web-based application, you have to deal with asynchronous and event-based programming from time to time. 无论是编写传统的桌面应用程序还是基于Web的应用程序,都必须不时处理异步和基于事件的编程。 Desktop applications have I/O operations and computationally expensive tasks that might take a long time to complete and potentially block other active threads. 桌面应用程序具有I / O操作和计算量大的任务,这些任务可能需要很长时间才能完成并有可能阻塞其他活动线程。 Furthermore, handling exceptions, cancellation, and synchronization is difficult and error-prone. 此外,处理异常,取消和同步非常困难且容易出错。

最佳和最接近的匹配是: https : //github.com/Aaronontheweb/helios ,它是Java Netty框架的等效端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM