C#itemSemiItemPriceBOMAddfl报错:Object reference not set to an instance of an objectGet返回null
这个错误通常是由于未初始化对象而导致的。在这种情况下,可能是因为SemiItemPriceBOM对象尚未被初始化,因此无法添加fl对象。
您可以在使用SemiItemPriceBOM之前初始化它,例如:
if (item.SemiItemPriceBOM == null)
{
item.SemiItemPriceBOM = new List<float>();
}
item.SemiItemPriceBOM.Add(fl);
这将确保SemiItemPriceBOM对象被初始化并可以添加fl对象。
原文地址: https://www.cveoy.top/t/topic/3Tg 著作权归作者所有。请勿转载和采集!