OmronFinsNetReadStringAsync 方法 (String, UInt16) |
异步读取字符串数据,默认为最常见的ASCII编码
Asynchronously read string data, default is the most common ASCII encoding
命名空间:
HslCommunication.Profinet.Omron
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public override Task<OperateResult<string>> ReadStringAsync(
string address,
ushort length
)
Public Overrides Function ReadStringAsync (
address As String,
length As UShort
) As Task(Of OperateResult(Of String))
public:
virtual Task<OperateResult<String^>^>^ ReadStringAsync(
String^ address,
unsigned short length
) override
abstract ReadStringAsync :
address : string *
length : uint16 -> Task<OperateResult<string>>
override ReadStringAsync :
address : string *
length : uint16 -> Task<OperateResult<string>>
参数
- address
- 类型:SystemString
起始地址 - length
- 类型:SystemUInt16
数据长度
返回值
类型:
TaskOperateResultString带有成功标识的string数据
实现
IReadWriteNetReadStringAsync(String, UInt16)IReadWriteNetReadStringAsync(String, UInt16)示例
以下为三菱的连接对象示例,其他的设备读写情况参照下面的代码:
MelsecMcNet melsec_net = new MelsecMcNet( "192.168.0.100", 6000 );
string d100_value = (await melsec_net.ReadStringAsync( "D100", 5 )).Content;
OperateResult<string> R_d100_value = await melsec_net.ReadStringAsync( "D100", 5 );
if (R_d100_value.IsSuccess)
{
string value = R_d100_value.Content;
}
else
{
}
参见