// // ISupportsExtraData.cs - interface for providing GetExtraData / SetExtraData methods // // Author: // Michael Becker // // Copyright (c) 2019-2021 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 MBS.Framework { /// /// Provides methods to store and retrieve extra data parameters on objects. /// public interface ISupportsExtraData { /// /// Gets the extra data with the specified key. If the extra data with the given key is not present, /// return the specified default value. /// /// The extra data with the specified key, or if not present. /// The key to look up. /// The default value to return if the key is not present. /// The type of data item to return. T GetExtraData(string key, T defaultValue = default(T)); /// /// Sets the extra data with the specified key and value. /// /// The name of the data item to set. /// The value to set. /// The type of data item to set. void SetExtraData(string key, T value); /// /// Gets the extra data with the specified key. If the extra data with the given key is not present, /// return the specified default value. /// /// The extra data with the specified key, or if not present. /// The key to look up. /// The default value to return if the key is not present. object GetExtraData(string key, object defaultValue = null); /// /// Sets the extra data with the specified key and value. /// /// The name of the data item to set. /// The value to set. void SetExtraData(string key, object value); } }