From ef3998055d770f032caaf2e026b40e404a01abce Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 6 Sep 2021 01:06:49 +0200 Subject: [PATCH] Prevented unnecessary allocations --- RGB.NET.Core/RGBSurface.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs index 6b9d726..f39ddc3 100644 --- a/RGB.NET.Core/RGBSurface.cs +++ b/RGB.NET.Core/RGBSurface.cs @@ -27,19 +27,12 @@ namespace RGB.NET.Core /// /// Gets a readonly list containing all loaded . /// - public IEnumerable Devices - { - get - { - lock (_devices) - return new ReadOnlyCollection(_devices); - } - } + public IReadOnlyCollection Devices { get; } /// /// Gets a readonly list containing all registered . /// - public IEnumerable UpdateTriggers => new ReadOnlyCollection(_updateTriggers); + public IReadOnlyCollection UpdateTriggers { get; } /// /// Gets a copy of the representing this . @@ -124,6 +117,9 @@ namespace RGB.NET.Core public RGBSurface() { _deltaTimeCounter = Stopwatch.StartNew(); + + Devices = new ReadOnlyCollection(_devices); + UpdateTriggers = new ReadOnlyCollection(_updateTriggers); } #endregion