How to solve Object reference not set to an instance of an object.? [duplicate]

You need to initialize the list first:

protected List<string> list = new List<string>();

I think you just need;

List<string> list = new List<string>();
list.Add("hai");

There is a difference between

List<string> list; 

and

List<string> list = new List<string>();

When you didn't use new keyword in this case, your list didn't initialized. And when you try to add it hai, obviously you get an error.