﻿using RevisionManager;
using System.Runtime.InteropServices;

internal static class Example
{

    public static void Main()
    {
        SolidEdgeFileProperties.PropertySets objPropertySets = null;
        SolidEdgeFileProperties.Properties objProperties = null;
        SolidEdgeFileProperties.Property objProperty = null;

        try
        {
            // Create a new instance of PropertySets.
            objPropertySets = new SolidEdgeFileProperties.PropertySets();
            objPropertySets.Open("C:\\Part1.par", false);
            objProperties = objPropertySets.Item("Custom");
            objProperty = objProperties.Add("My Custom Property", "My Custom Value");
            objPropertySets.Save();
            objPropertySets.Close();
        }
        catch (Exception ex)
        {
            // Write any errors to console.
            Console.WriteLine(ex.Message);
        }
        finally
        {
            // Release COM Objects.
            if (objProperties != null)
            {
                Marshal.ReleaseComObject(objProperties);
                objProperties = null;
            }
            if (objPropertySets != null)
            {
                Marshal.ReleaseComObject(objPropertySets);
                objPropertySets = null;
            }
        }
    }

}