Prevented unnecessary allocations

This commit is contained in:
DarthAffe committed 2021-09-06 01:06:49 +02:00
1 parent d487bee35c
commit ef3998055d
1 file changed
+5 -9
+5 -9
View File
@@ -27,19 +27,12 @@ namespace RGB.NET.Core
/// <summary> /// <summary>
/// Gets a readonly list containing all loaded <see cref="IRGBDevice"/>. /// Gets a readonly list containing all loaded <see cref="IRGBDevice"/>.
/// </summary> /// </summary>
public IEnumerable<IRGBDevice> Devices public IReadOnlyCollection<IRGBDevice> Devices { get; }
{
get
{
lock (_devices)
return new ReadOnlyCollection<IRGBDevice>(_devices);
}
}
/// <summary> /// <summary>
/// Gets a readonly list containing all registered <see cref="IUpdateTrigger"/>. /// Gets a readonly list containing all registered <see cref="IUpdateTrigger"/>.
/// </summary> /// </summary>
public IEnumerable<IUpdateTrigger> UpdateTriggers => new ReadOnlyCollection<IUpdateTrigger>(_updateTriggers); public IReadOnlyCollection<IUpdateTrigger> UpdateTriggers { get; }
/// <summary> /// <summary>
/// Gets a copy of the <see cref="Rectangle"/> representing this <see cref="RGBSurface"/>. /// Gets a copy of the <see cref="Rectangle"/> representing this <see cref="RGBSurface"/>.
@@ -124,6 +117,9 @@ namespace RGB.NET.Core
public RGBSurface() public RGBSurface()
{ {
_deltaTimeCounter = Stopwatch.StartNew(); _deltaTimeCounter = Stopwatch.StartNew();
Devices = new ReadOnlyCollection<IRGBDevice>(_devices);
UpdateTriggers = new ReadOnlyCollection<IUpdateTrigger>(_updateTriggers);
} }
#endregion #endregion