Set

RawDictionaryBasePackage.Set method

Adds or replaces the specified tag.

public void Set(RawTag tag)
Parameter Type Description
tag RawTag The tag to set.

Examples

This code sample demonstrates how to add a custom tag to an EXIF package.

using (Metadata metadata = new Metadata(Constants.RawWithExif))
{
    IExif root = metadata.GetRootPackage() as IExif;
    if (root != null)
    {
        // Set the EXIF package if it's missing
        if (root.ExifPackage == null)
        {
            root.ExifPackage = new ExifPackage();
        }

        // Add a known property
        root.ExifPackage.Set(new RawAsciiTag(uint.Artist, "test artist"));

        // Add a fully custom property (which is not described in the EXIF specification).
        // Please note that the chosen ID may intersect with the IDs used by some third party tools.
        root.ExifPackage.Set(new RawAsciiTag((uint)65523, "custom"));

        metadata.Save(Constants.OutputRaw);
    }
}

See Also