gpt4 book ai didi

c# - 'lambda expression' 和 'lambda expression' 之间没有隐式转换?

转载 作者:IT王子 更新时间:2023-10-29 04:04:59 26 4
gpt4 key购买 nike

<分区>

Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression'

说什么?有人可以向我解释这个编译错误吗?这是生成它的代码:

    protected override Func<System.IO.Stream> GetStream()
{
return someBool
? () => EmbeddedResourceExtractor.GetFile("SomeFile1.ext")
: () => EmbeddedResourceExtractor.GetFile("SomeFile2.ext");
}

这不是:

    protected override Func<System.IO.Stream> GetStream()
{
return () => EmbeddedResourceExtractor.GetFile("SomeFile1.ext");
}

也不要这样做:

    protected override Func<System.IO.Stream> GetStream()
{
if(someBool)
return () => EmbeddedResourceExtractor.GetFile("SomeFile1.ext");
return () => EmbeddedResourceExtractor.GetFile("SomeFile2.ext");
}

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