把类型转为可空类型,如下例: 

 int? max = (from t in db.Tags
where t.ParentId == request.TargetId
select (int?) t.SortOrder).Max();

if (!max.HasValue)
max = 1;
else
max += 1;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
猜你喜欢
  • 2021-10-22
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案