/// <summary> /// Deletes the property and value given the property name specified. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="propertyName"></param> /// <returns></returns> public bool Delete <T>(string propertyName) { lock (_lock) { if (PropertyNameList.Contains(propertyName) && PropertyNameList[propertyName].DataType == typeof(T)) { PropertyNameList.Remove(propertyName); IsDirty = true; return(true); } } return(false); }
/// <summary> /// Stores the new value for the names property. If the property does not exist in the blob /// a new column will be created. Property names are case insensitive. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="propName"></param> /// <param name="value"></param> public void Set <T>(string propertyName, T value) { lock (_lock) { if (!PropertyNameList.Contains(propertyName)) { PropertyNameList.Add(propertyName, typeof(T)); } ItemColumn column = PropertyNameList[propertyName]; PropertyValueList.Insert(PropertyNameList.IndexOf(column), value); IsDirty = true; RaisePropertyChanged(propertyName); } }
/// <summary> /// Get the current value of a property. If the property does not exist, the default value /// for the type will be returned and the function returns FALSE. Property names are /// case insensitive. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="propertyName"></param> /// <param name="value"></param> /// <returns></returns> public bool Get <T>(string propertyName, out T value) { lock (_lock) { value = default(T); if (PropertyNameList.Contains(propertyName) && PropertyNameList[propertyName].DataType == typeof(T)) { ItemColumn column = PropertyNameList[propertyName]; int index = PropertyNameList.IndexOf(column); value = (T)PropertyValueList[index]; return(true); } } return(false); }