Click or drag to resize

GH_ArchiveAppendObject Method

Appends a target object into the root node of this archive tree. If the root doesn't exist yet, it will be created. Existing objects at the root scope will not be affected.

Namespace:  GH_IO.Serialization
Assembly:  GH_IO (in GH_IO.dll)
Syntax
public bool AppendObject(
	GH_ISerializable target,
	string targetName
)

Parameters

target
Type: GH_IOGH_ISerializable
Object to append. Cannot be null.
targetName
Type: SystemString
Name of object to append, name must be unique.

Return Value

Type: Boolean
True on succes, false on failure.
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown if target is a null reference.
ArgumentNullExceptionThrown if the target_name is null or empty.
Examples
This sample shows how to create a new archive and serialize a single top level object.
C#
bool CreateFile(string file_name, GH_ISerializable target, string target_name) 
{
  GH_Archive archive = new GH_Archive();
  archive.AppendObject(target, target_name);
  return archive.WriteToFile(file_name, true);
}
See Also