Add array to plist post process

So I can add key/value in the plist using the PlistElementDict object but I can’t see how to add an array.

I can create the array but there is no SetArray method (which would sound appropriate next to other SetXXXX methods).

Here is how far I got:

PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));  
PlistElementDict rootDict = plist.root;

key = "MyKey";
rootDict.CreateArray(key);

PlistElementArray array = new PlistElementArray();
array.AddString("ValueA");
array.AddString("ValueB);

Now I would expect a method to add the array to the rootDict object but I can’t figure out how it is meant to happen.

Any insight?

Well it was actually simple. The documentation could include a bit more details on that.

     rootDict.CreateArray(key);

this returns the array object

PlistDocument plist = new PlistDocument();
 plist.ReadFromString(File.ReadAllText(plistPath));  
 PlistElementDict rootDict = plist.root;
 
 key = "MyKey";
 
 PlistElementArray array = rootDict.CreateArray(key);
 array.AddString("ValueA");
 array.AddString("ValueB);

Now array points to the array object newly created and item can be added to it.