public static Property AddOrRetrieve(
            this PropertyCollection properties,
            string name,
            ITypeReference typeReference,
            ValueUseOption valueUsage,
            object defaultValue)
        {
            if (!properties.ContainsName(name))
            {
                properties.Add(new Property(name, typeReference, valueUsage, defaultValue));
            }

            return(properties.GetItemByName(name));
        }
 public static bool PropertyValueEquals <T>(this PropertyCollection properties, string name, T comparisonValue)
 {
     return(properties.GetItemByName(name).GetValue <T>().Equals(comparisonValue));
 }