开发者

Sync class library for async serial port calls in C#

开发者 https://www.devze.com 2023-03-21 02:22 出处:网络
I need to write a .NET 2.0 C# class library to wrap some calls to a serial port. I already know that using DataReceived event of the SerialPort object is (probably) the best way to read data from the

I need to write a .NET 2.0 C# class library to wrap some calls to a serial port.

I already know that using DataReceived event of the SerialPort object is (probably) the best way to read data from the port just when they are available for read.

Nevertheless, calls to my class library should be sync and then I can't use DataRe开发者_JAVA技巧ceived that is async.

Is there a suggested develop pattern to do a thing like that?

Thanks, Manuel


Just use a while loop while waiting for your data.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号