I have class
public class Gallery
{
public string method { get; set; }
public List<List<object>> gidlist { get; set; }
public int @namespace { get; set; }
}
Button code
private void button1_Click(object sender, EventArgs e)
{
List<object> data = new List<object>();
data.Add(618395);
data.Add("0439fa3666");
Gallery jak = new Gallery();
jak.method = "gdata";
jak.gidlist.Add(data);
jak.@namespace = 1;
string json = JsonConvert.SerializeObject(jak);
textBox2.Text = json;
}
Here I get System.NullReferenceException. How to add item to gidlist ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…