下面是代码实现,我无法将int []转换为int?[]
days = !string.IsNullOrWhiteSpace(Days) ?
Days.Split("|").Select(x => Convert.ToInt32(x)).ToArray() : null
如何单行解决
答案 0 :(得分:1)
将Convert.ToInt32结果转换为int吗?:
days = !string.IsNullOrWhiteSpace(Days) ?
Days.Split("|").Select(x => (int?)Convert.ToInt32(x)).ToArray() : null