From b4c10aa0f44ceca3138bc567d5fe837288910b55 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 25 Sep 2017 21:10:10 +0200 Subject: [PATCH] Added a method to remove all decorators from a decoratable --- RGB.NET.Core/Decorators/AbstractIDecorateable.cs | 7 +++++++ RGB.NET.Core/Decorators/IDecoratable.cs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/RGB.NET.Core/Decorators/AbstractIDecorateable.cs b/RGB.NET.Core/Decorators/AbstractIDecorateable.cs index aa7996d..9772b97 100644 --- a/RGB.NET.Core/Decorators/AbstractIDecorateable.cs +++ b/RGB.NET.Core/Decorators/AbstractIDecorateable.cs @@ -37,6 +37,13 @@ namespace RGB.NET.Core decorator.OnDetached(this); } + /// + public void RemoveAllDecorators() + { + foreach (T decorator in Decorators.ToList()) + RemoveDecorator(decorator); + } + #endregion } } diff --git a/RGB.NET.Core/Decorators/IDecoratable.cs b/RGB.NET.Core/Decorators/IDecoratable.cs index 898efb1..1930942 100644 --- a/RGB.NET.Core/Decorators/IDecoratable.cs +++ b/RGB.NET.Core/Decorators/IDecoratable.cs @@ -25,5 +25,10 @@ /// /// The to be removed. void RemoveDecorator(T decorator); + + /// + /// Removes all from the . + /// + void RemoveAllDecorators(); } }