Change TParamOut to class

This commit is contained in:
parallelbgls
2017-05-23 16:24:51 +08:00
parent a546e6d77c
commit fa8dbf9fd3
3 changed files with 5 additions and 7 deletions

View File

@@ -38,7 +38,7 @@ namespace Modbus.Net
/// 基本协议
/// </summary>
public abstract class BaseProtocal<TParamIn, TParamOut, TProtocalUnit> :
IProtocal<TParamIn, TParamOut, TProtocalUnit> where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut>
IProtocal<TParamIn, TParamOut, TProtocalUnit> where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut> where TParamOut : class
{
/// <summary>
/// 构造器

View File

@@ -44,7 +44,7 @@ namespace Modbus.Net
/// 基础Api入口
/// </summary>
public abstract class BaseUtility<TParamIn, TParamOut, TProtocalUnit> : IUtilityProperty, IUtilityMethodData
where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut>
where TProtocalUnit : ProtocalUnit<TParamIn, TParamOut> where TParamOut : class
{
/// <summary>
/// 协议收发主体

View File

@@ -70,7 +70,7 @@ namespace Modbus.Net
/// <summary>
/// 基本的协议连接器
/// </summary>
public abstract class ProtocalLinker<TParamIn, TParamOut> : IProtocalLinker<TParamIn, TParamOut>
public abstract class ProtocalLinker<TParamIn, TParamOut> : IProtocalLinker<TParamIn, TParamOut> where TParamOut : class
{
/// <summary>
/// 传输连接器
@@ -106,8 +106,7 @@ namespace Modbus.Net
{
var extBytes = BytesExtend(content);
var receiveBytes = await SendReceiveWithoutExtAndDecAsync(extBytes);
if (receiveBytes != null) return receiveBytes;
throw new NullReferenceException();
return receiveBytes;
}
/// <summary>
@@ -132,8 +131,7 @@ namespace Modbus.Net
//容错处理
var checkRight = CheckRight(receiveBytes);
//返回字符
if (checkRight == true) return receiveBytes;
throw new NullReferenceException();
return checkRight == true ? receiveBytes : null;
}
/// <summary>