C# Google Sheets APIv4 filling requestbody

Sorry if this question is very basic. I'm trying to create an update request to fill me some googledocs spreadsheets with content (btw the portion of the code that READS those sheets works just fine), but, being intermediate at best, I can not wrap my head around this issue.

So here's the problematic fraction of the code:

 Data.ValueRange requestBody = new Data.ValueRange();
 var test = new string[] { "p1", "p2", "p3", "", "", "", "", "iwannadie" };
 requestBody.Values.Add(test);`

The third line of this code returns System.NullReferenceException, Object reference is not set to an instance of an object. What gives?

requestBody.Values has a type of IList<IList<object>>, trying to instead use this code:
requestBody.Values.Add(new IList<object> { "", "", "" });

Results in compiler error "Can not create instance of abstract class lol suffer". And trying to Add a List gives compiler error "can not convert List into IList". Please help q-q

Jon Skeet
people
quotationmark

Basically, requestBody.Values will be null until you populate it.

Just create your own list and populate it with your array, e.g.

var test = new string[] { "p1", "p2", "p3", "", "", "", "", "foo" };
requestBody.Values = new List<IList<object>> { test };

people

See more on this question at Stackoverflow