From 6974203e34433fca78b2c946f5931ab2b7dc9126 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 6 Sep 2021 00:55:42 +0200 Subject: [PATCH] Prevented unnecessary allocations --- RGB.NET.Core/Decorators/AbstractDecorateable.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/RGB.NET.Core/Decorators/AbstractDecorateable.cs b/RGB.NET.Core/Decorators/AbstractDecorateable.cs index 8acfc54..50602ae 100644 --- a/RGB.NET.Core/Decorators/AbstractDecorateable.cs +++ b/RGB.NET.Core/Decorators/AbstractDecorateable.cs @@ -14,13 +14,18 @@ namespace RGB.NET.Core private readonly List _decorators = new(); /// - public IReadOnlyCollection Decorators + public IReadOnlyCollection Decorators { get; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + protected AbstractDecoratable() { - get - { - lock (_decorators) - return new ReadOnlyCollection(_decorators); - } + Decorators = new ReadOnlyCollection(_decorators); } #endregion