// Multidimensional array:
byte[,] multi = $arrMultiDArray$
/********* SERIALIZE MULTIDIMENSIONAL ARRAY INTO REGISTRY *********/
using (MemoryStream ms = new MemoryStream())
{
    BinaryFormatter bf = new BinaryFormatter();
    // Serialized the multidimensional array here:
    bf.Serialize(ms, multi);
    // Write the serialized data to the registry:
    Microsoft.Win32.Registry.SetValue(
        @$strRegistryKey$,
        $strRegistryKeyVariable$,
        ms.ToArray());
}
/********* DESERIALIZE MULTIDIMENSIONAL ARRAY FROM REGISTRY  *********/
using (MemoryStream ms = new MemoryStream())
{
    BinaryFormatter bf = new BinaryFormatter();
    // Get the serialized binary data from the registry:
    Object objReg = Microsoft.Win32.Registry.GetValue(
        @$strRegistryKey$,
        $strRegistryKeyVariable$,
        null);
    byte[] serialized = (byte[])objReg;
    // Write the contents of the stream to a buffer for reading later:
    ms.Write(serialized, 0, serialized.Length);
    // Since we wrote to the stream, reset the cursor:
    ms.Position = 0;
    // Deserialize the multidimensional array:
    multi = (byte[,])bf.Deserialize(ms); 
    // Now you have your multidimensional array back!
}
                 |