NullReferenceException when trying to set class property

后端 未结 7 1776
醉酒成梦
醉酒成梦 2021-01-22 00:56

Basically I have 2 classes, \"Manifest\" and \"BrowserAction\", set out like this:

public class BrowserAction
{
    public string default_icon {get; set;}
    pu         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 01:52

    You'll have to intialize browser_action too before accessing properties on that instance.

    newManifest.browser_action= new BrowserAction();
    

提交回复
热议问题