mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Prevented unnecessary allocations
This commit is contained in:
parent
d487bee35c
commit
ef3998055d
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user