Init
This commit is contained in:
30
Prefab.Base/ICanBeCustomized.cs
Normal file
30
Prefab.Base/ICanBeCustomized.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace Prefab.Base;
|
||||
|
||||
/// <summary>
|
||||
/// Contract for models that expose a customizable attribute bag to module developers.
|
||||
/// </summary>
|
||||
public interface ICanBeCustomized : IHasGenericAttributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets or updates a custom attribute value.
|
||||
/// </summary>
|
||||
/// <param name="key">The attribute name.</param>
|
||||
/// <param name="value">The value to store.</param>
|
||||
void SetAttribute(string key, object value);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a custom attribute by key.
|
||||
/// </summary>
|
||||
/// <param name="key">The attribute to remove.</param>
|
||||
/// <returns><c>true</c> when the key existed and was removed.</returns>
|
||||
bool RemoveAttribute(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to read an attribute value.
|
||||
/// </summary>
|
||||
/// <param name="key">The attribute to inspect.</param>
|
||||
/// <param name="value">Receives the typed attribute value when present.</param>
|
||||
/// <typeparam name="T">The expected attribute type.</typeparam>
|
||||
/// <returns><c>true</c> when the attribute exists and matches the requested type.</returns>
|
||||
bool TryGetAttribute<T>(string key, out T value);
|
||||
}
|
||||
Reference in New Issue
Block a user