Null Reference exception in C#

后端 未结 3 2006
慢半拍i
慢半拍i 2021-01-25 09:17

I\'m experiencing \"null reference exception\" when I\'m attempting to return a value from a structure.

here is the code:

AssetItem item = new AssetItem(         


        
3条回答
  •  失恋的感觉
    2021-01-25 09:47

    On a side note, why create a new instance then re-assign to it without using it for any purpose..

    AssetItem item = new AssetItem();  
    item = initModified();
    

    Could become

    AssetItem item =  initModified();
    

提交回复
热议问题