我喜欢这段代码:
private FoundContours SelectFromFoundSamples(FoundContours foundACContours, FoundContours foundFNContours, FoundContours foundBlurContours, FoundContours foundFilteredContours)
{
int? num = null;
int? a = null, b = null, c = null, d = 10;
int?[] numbers = new[] { foundACContours.Count, foundFNContours.Count, foundBlurContours.Count, foundFilteredContours.Count };
int? max = numbers.Max();
}
在这一行:
int?[] numbers = new[] { foundACContours.Count, foundFNContours.Count, foundBlurContours.Count, foundFilteredContours.Count };
我收到此错误:
“不能将类型'int?[]'隐式转换为'int []'
知道如何修复错误?
提前谢谢。
答案 0 :(得分:7)
只需更改您的陈述
int?[] numbers = new[] { foundACContours.Count, foundFNContours.Count,
foundBlurContours.Count, foundFilteredContours.Count };
要
int?[] numbers = new int?[] { foundACContours.Count, foundFNContours.Count,
foundBlurContours.Count, foundFilteredContours.Count };
答案 1 :(得分:3)
int?[] numbers = new int?[] { foundACContours.Count, foundFNContours.Count, foundBlurContours.Count, foundFilteredContours.Count };