Exemplo n.º 1
0
        public T Add(ExtensionProperty <T> property, T value)
        {
            if (!Values.TryAdd(property, value))
            {
                throw new RedefinedPropertyException(property);
            }

            return(value);
        }
Exemplo n.º 2
0
        public T Get(ExtensionProperty <T> property)
        {
            T value;

            if (!Values.TryGetValue(property, out value))
            {
                return(default(T));//throw new UndefinedPropertyException(property);
            }
            return(value);
        }
Exemplo n.º 3
0
 public static T GetOrAdd <T>(
     this object context,
     ExtensionProperty <T> property,
     Func <T> valueFactory) =>
 Store(context)
 .GetOrAdd(property, valueFactory);
Exemplo n.º 4
0
 public static T Get <T>(
     this object context,
     ExtensionProperty <T> property) =>
 Store(context)
 .Get(property);
Exemplo n.º 5
0
 public static T Add <T>(
     this object context,
     ExtensionProperty <T> property,
     T value) =>
 Store(context)
 .Add(property, value);
Exemplo n.º 6
0
 public T GetOrAdd(ExtensionProperty <T> property, Func <T> valueFactory) =>
 Values.GetOrAdd(property, p => valueFactory());