Add GetString Function in ValueHelper

This commit is contained in:
parallelbgls
2016-11-24 16:34:20 +08:00
parent 5c0abde59e
commit 6d96dbd036

View File

@@ -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;
}
/// <summary>
/// 将byte数组中相应的位置转换为字符串
/// </summary>
/// <param name="data"></param>
/// <param name="count"></param>
/// <param name="pos"></param>
/// <param name="encoding"></param>
/// <returns></returns>
public virtual string GetString(byte[] data, int count, ref int pos, Encoding encoding)
{
string t = encoding.GetString(data, pos, count);
pos += count;
return t;
}
/// <summary>
/// 将byte数组中相应的位置转换为8个bit数字
/// </summary>