NullReferenceException when trying to set class property

后端 未结 7 1691
醉酒成梦
醉酒成梦 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 02:01

    change your manifest class to

    public class Manifest
    {
        public BrowserAction browser_action { get; set; }
        public Manifest()
        {
            browser_action = new BrowserAction();
        }
    }
    

    the problem is the property browser_action never initialiazed!

    0 讨论(0)
提交回复
热议问题