gpt4 book ai didi

c# - 无法将类型 'int?[]' 隐式转换为 'int[]

转载 作者:行者123 更新时间:2023-11-30 19:18:19 27 4
gpt4 key购买 nike

我哈哈这一段代码:

    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[]’

知道如何修复错误吗?

提前谢谢你。

最佳答案

只是改变你的声明

int?[] numbers = new[] { foundACContours.Count, foundFNContours.Count, 
foundBlurContours.Count, foundFilteredContours.Count };

int?[] numbers = new int?[] { foundACContours.Count, foundFNContours.Count, 
foundBlurContours.Count, foundFilteredContours.Count };

关于c# - 无法将类型 'int?[]' 隐式转换为 'int[],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13173332/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com