Sync class library for async serial port calls in C#
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.
精彩评论