コード例 #1
0
		void MakeDirty()
		{
			// called within syncroot
			if (!isDirty) {
				isDirty = true;
				if (parent != null)
					parent.MakeDirty();
			}
		}
コード例 #2
0
		/// <summary>
		/// Retrieves a nested property container; creating a new one on demand.
		/// Multiple calls to this method will return the same instance (unless the entry at this key
		/// is overwritten by one of the Set-methods).
		/// Changes performed on the nested container will be persisted together with the parent container.
		/// </summary>
		public Properties NestedProperties(string key)
		{
			bool isNewContainer = false;
			Properties result;
			lock (syncRoot) {
				object oldValue;
				dict.TryGetValue(key, out oldValue);
				result = oldValue as Properties;
				if (result == null) {
					result = new Properties(this);
					dict[key] = result;
					result.MakeDirty();
				}
			}
			if (isNewContainer)
				OnPropertyChanged(key);
			return result;
		}