public static bool TryGetValueAsObject(
     this IPropertyHolder propertyBag,
     string propertyName,
     out object value)
 {
     return(propertyBag.TryGetValue <object>(propertyName, out value));
 }
 public static TValue GetValueOrDefault <TValue>(
     this IPropertyHolder propertyBag,
     string propertyName,
     TValue defaultValue)
 {
     return(propertyBag.TryGetValue <TValue>(propertyName, out var value)
                         ? value
                         : defaultValue);
 }
        public static TValue GetValueOrDefault <TValue>(
            this IPropertyHolder propertyBag,
            string propertyName,
            Func <TValue> defaultValueProvider)
        {
            if (defaultValueProvider == null)
            {
                throw new ArgumentNullException(nameof(defaultValueProvider));
            }

            return(propertyBag.TryGetValue <TValue>(propertyName, out var value)
                                ? value
                                : defaultValueProvider.Invoke());
        }