AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
# Compiler Error CS0845 表达式树 lambda 不能在合并运算符左侧包含 null 文本。 由于 null 本身不具有类型,因此 null 合并运算符无法对其进行运算。 ## 更正此错误 1. 将 null 文本强制转换为对象。 下面的代码将生成 CS0845: ``` // cs0845.cs using System; using System.Linq; using System.Linq.Expressions; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Expression<Func<object>> e = () => null ?? null; // CS0845 // Try the following line instead. // Expression<Func<object>> e = () => (object)null ?? null; } } } ```