把类型转为可空类型,如下例:
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;
把类型转为可空类型,如下例:
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;
相关文章: