开发者

C# Closing the serial port when no one is using it

开发者 https://www.devze.com 2023-04-10 21:24 出处:网络
I have an object of SerialPort. It is used by multiple object of some class. Is there some eleg开发者_如何学Goant solution to close the port when no one is using it?

I have an object of SerialPort. It is used by multiple object of some class. Is there some eleg开发者_如何学Goant solution to close the port when no one is using it?

The only thing i came up is straightforward: write some manager class above SerialPort with users counter.


I dont know how i can put a comment, i search but i dont find. So the answer, if you use from the same class, alway when you finish to use you close, and if are multiple user to use at the same time you can see if is busy or not the SerialPort. So when your are go to use you check if is busy, and when you finish you close. If you need some code tell me and i write to you.

0

精彩评论

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