// // PropertyValue.cs - represents the value of a property in a designer object // // Author: // Michael Becker // // Copyright (c) 2011-2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; namespace UniversalEditor.ObjectModels.Designer { /// /// Represents the value of a property in a designer object. /// public class PropertyValue { public class PropertyValueCollection : System.Collections.ObjectModel.Collection { public PropertyValue this[Property property] { get { for (int i = 0; i < Count; i++) { if (this[i].Property == property) return this[i]; } return null; } } } public PropertyValue(Property property, object value = null) { Property = property; Value = value; } /// /// Gets or sets the property associated with this . /// /// The property. public Property Property { get; set; } = null; /// /// Gets or sets a value indicating whether this /// has its value set. /// /// true if the value is set; otherwise, false. public bool IsSet { get; set; } = false; /// /// Gets or sets the value of this . /// /// The value of the property. public object Value { get; set; } = null; public object Clone() { object value = Value; if (Value is ICloneable) { value = (Value as ICloneable).Clone(); } PropertyValue clone = new PropertyValue(Property, value); return clone; } } }