/// <summary> /// Sets the value. /// </summary> /// <typeparam name="T"> </typeparam> /// <param name="container"> The container. </param> /// <param name="property"> The property. </param> /// <param name="value"> The value. </param> public static void SetValue <T> (this IStateMetaContainer container, IStateMetaProperty property, T value) { if (container == null) { throw new ArgumentNullException("container"); } if (property == null) { throw new ArgumentNullException("property"); } container.SetValue(property, value); }
/// <summary> /// Gets the value. /// </summary> /// <typeparam name="T"> </typeparam> /// <param name="container"> The container. </param> /// <param name="property"> The property. </param> /// <returns> </returns> public static T GetValue <T> (this IStateMetaContainer container, IStateMetaProperty property) { if (container == null) { throw new ArgumentNullException("container"); } if (property == null) { throw new ArgumentNullException("property"); } return(( T )container.GetValue(property)); }
/// <summary> /// Sets the value. /// </summary> /// <param name="data"> The data. </param> /// <param name="value"> The value. </param> public void SetValue(IStateMetaProperty data, object value) { if (value != null && data.Type != value.GetType( )) { throw new Exception("Value provided does not match the meta property value type"); } if (_values.ContainsKey(data.ID)) { _values.Remove(data.ID); } _values.Add(data.ID, value); }
/// <summary> /// Gets the value. /// </summary> /// <param name="data"> The data. </param> /// <returns> </returns> public object GetValue(IStateMetaProperty data) { return(_values.ContainsKey(data.ID) ? _values [data.ID] : data.Default); }