Files
WindowsFormsApp6/packages/System.IO.Ports.8.0.0/PACKAGE.md

60 lines
2.0 KiB
Markdown
Raw Normal View History

2025-12-31 09:43:35 +08:00
## About
<!-- A description of the package and where one can find more documentation -->
[System.IO.Ports](https://www.nuget.org/packages/System.IO.Ports) package provides synchronous serial port file resource. Additionally, the functionality of this class can be wrapped in an internal `Stream` object, accessible through the `BaseStream` property, and passed to classes that wrap or use streams.
## Key Features
<!-- The key features of this package -->
* synchronous and event-driven I/O
* access to pin and break states
* access to serial driver properties
* access to `Stream` object through the `BaseStream` property
## How to Use
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
```C#
using System.IO.Ports;
// Provides list of available serial ports
string[] portNames = SerialPort.GetPortNames();
// First available port
string myPortName = portNames[0];
int baudRate = 9600;
SerialPort sp = new SerialPort(myPortName, baudRate);
sp.Open();
sp.WriteLine("Hello World!");
```
## Main Types
<!-- The main types provided in this library -->
The main type provided by this library is:
* `SerialPort`
## Additional Documentation
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
* [SerialPort class documentation](https://learn.microsoft.com/dotnet/api/system.io.ports.serialport?view=dotnet-plat-ext-7.0)
* [API documentation](https://learn.microsoft.com/dotnet/api/System.IO.Ports)
## Related Packages
<!-- The related packages associated with this package -->
- [System.IO.Ports](https://www.nuget.org/packages/System.IO.Ports)
## Feedback & Contributing
<!-- How to provide feedback on this package and contribute to it -->
System.IO.Ports is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).