diff --git a/Modbus.Net/Modbus.Net/ValueHelper.cs b/Modbus.Net/Modbus.Net/ValueHelper.cs index 303af5a..377ff6d 100644 --- a/Modbus.Net/Modbus.Net/ValueHelper.cs +++ b/Modbus.Net/Modbus.Net/ValueHelper.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Text; namespace Modbus.Net { @@ -386,6 +387,21 @@ namespace Modbus.Net return t; } + /// + /// 将byte数组中相应的位置转换为字符串 + /// + /// + /// + /// + /// + /// + public virtual string GetString(byte[] data, int count, ref int pos, Encoding encoding) + { + string t = encoding.GetString(data, pos, count); + pos += count; + return t; + } + /// /// 将byte数组中相应的位置转换为8个bit数字 ///