把类型转为可空类型,如下例:
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;
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3