Writing array of strings attribute in in Hdf5.net from C#

Hello,

I'm new to HDF5, especially with C#. I'm using the HDF5.net wrappers.

On a particular dataset, I am writing several attributes including some scalar ints, scalar strings and an array of ints. I would also like to write out an array of strings as an attribute. I have some success from C++ using HDF5 but am having trouble even getting going from C# using HDF5.net. Here is what I am trying:

// friendly names attribute
H5AttributeId attrFriendlyNameId = H5A.create(dataSetId, "Friendly Name", H5T.create(H5T.CreateClass.STRING, 256), H5S.create_simple(2, new long[2] { 1, _numChannels }));
H5A.write(attrFriendlyNameId, H5T.create(H5T.CreateClass.STRING, 256), new H5Array<byte[]>(_friendlyNameArrayAscii[cardNumber]));

friendlyNameArray is defined thus:
privatebyte[][][] _friendlyNameArrayAscii =newbyte[_numBoards][][];

I'm certainly not sure of my syntacs. I picked this because it worked for a single string attribute I was printing out. Namely:

byte[] asciiStr = ASCIIEncoding.ASCII.GetBytes(GetBoardNameFromCardNum(cardNumber));
H5AttributeId attrBoardNameId = H5A.create(dataSetId, "Board Name", H5T.create(H5T.CreateClass.STRING, 256), H5S.create(H5S.H5SClass.SCALAR));
H5A.write(attrBoardNameId, H5T.create(H5T.CreateClass.STRING,256), new H5Array<byte>(asciiStr));

As I said, I have some siucess in C++ with different syntax (that I can't find the c# equivalent for!). Briefly I do:

// Friendly Name Attribute
static char staticfriendlyName[NUMBEROFCHANNELPERBOARD][128];
StrType strdatatype(PredType::C_S1, 256); // of length 256 characters
Attribute attributeFriendlyName = dataSet.createAttribute(attrFriendlyName, strdatatype, attr_dataspace_channelLengths);
attributeFriendlyName.write(strdatatype, staticfriendlyName);

I've attached a jpg of the output of C++ (and what I'd like to see with C#).

Since starting to write this, I've noticed that my C++ output isn't quite perfect. If you look careful and Friendly Name, you will see that the names start off fine, but then garbage is printed out. There should be 16 names only.

I have reviewed the examples at

hd5.net (see HDF5DotNet source and examples). I could not find an example as complicated as an array of strings. If I'm missing it, or there are other examples, please point me to them. Thanks,

Andrew David Walker