/// <summary> /// Open a H5Group at `location` relative to the hdf5 root group, /// creating subgroups as necessary. /// </summary> public H5Group MakeGroups(string location) { location = location.Trim('/'); H5Group tmp, node = null; foreach (string subloc in location.Split('/')) { if (node == null) { node = Root.SubGroup(subloc, create: true); } else { // note: if we could rely on the GC, we // wouldn't need a temporary variable.. tmp = node.SubGroup(subloc, create: true); node.Dispose(); node = tmp; } } // re-open the group for its '.Key' set to our 'location'.. node.Dispose(); node = Root.SubGroup(location); return(node); }
/// <summary> /// Close the file to release the file handle. /// </summary> public override void Dispose() { Root.Dispose(); // force garbage collection.. GC.Collect(); // ..and wait for all finalizers to complete before continuing. // this helps to prevent a delayed closing of the hdf5-file by // calling the .close() method on all dangling H5Objects. GC.WaitForPendingFinalizers(); base.Dispose(); if (ID > 0) { ID = H5F.close(ID); } }