点击或拖拽改变大小

HslExtensionReceive 方法

从串口接收指定长度的字节数组信息,还可以指定超时时间,以及休眠间歇时间。
Receive byte array information of specified length from the serial port, and can also specify the timeout time and sleep intermittent time.

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static OperateResult<byte[]> Receive(
	this SerialPort serialPort,
	int length,
	int timeout,
	int sleepTime
)

参数

serialPort
类型:System.IO.PortsSerialPort
串口信息
length
类型:SystemInt32
准备接收的字节长度
timeout
类型:SystemInt32
超时时间
sleepTime
类型:SystemInt32
间歇休眠时间

返回值

类型:OperateResultByte
接收的结果内容对象

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型 SerialPort 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。
参见