mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Used new collection-initialization
This commit is contained in:
parent
654a7624cd
commit
47770c00b8
@ -43,7 +43,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
|
||||
IRGBDeviceInfo IRGBDevice.DeviceInfo => DeviceInfo;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IList<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
|
||||
public IList<IColorCorrection> ColorCorrections { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the device needs to be flushed on every update.
|
||||
@ -63,7 +63,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
|
||||
#region Indexer
|
||||
|
||||
/// <inheritdoc />
|
||||
Led? IRGBDevice.this[LedId ledId] => LedMapping.TryGetValue(ledId, out Led? led) ? led : null;
|
||||
Led? IRGBDevice.this[LedId ledId] => LedMapping.GetValueOrDefault(ledId);
|
||||
|
||||
/// <inheritdoc />
|
||||
Led? IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.Boundary.Contains(location));
|
||||
|
||||
@ -20,7 +20,7 @@ public sealed class ListLedGroup : AbstractLedGroup
|
||||
/// <summary>
|
||||
/// Gets the list containing the <see cref="Led"/> of this <see cref="ListLedGroup"/>.
|
||||
/// </summary>
|
||||
private readonly IList<Led> _groupLeds = new List<Led>();
|
||||
private readonly IList<Led> _groupLeds = [];
|
||||
|
||||
#endregion
|
||||
|
||||
@ -142,7 +142,7 @@ public sealed class ListLedGroup : AbstractLedGroup
|
||||
public override IList<Led> ToList()
|
||||
{
|
||||
lock (_groupLeds)
|
||||
return new List<Led>(_groupLeds);
|
||||
return [.._groupLeds];
|
||||
}
|
||||
|
||||
protected override IDisposable ToListUnsafe(out IList<Led> leds)
|
||||
|
||||
@ -20,8 +20,8 @@ public sealed class RGBSurface : AbstractBindable, IDisposable
|
||||
|
||||
private readonly Stopwatch _deltaTimeCounter;
|
||||
|
||||
private readonly IList<IRGBDevice> _devices = new List<IRGBDevice>();
|
||||
private readonly IList<IUpdateTrigger> _updateTriggers = new List<IUpdateTrigger>();
|
||||
private readonly IList<IRGBDevice> _devices = [];
|
||||
private readonly IList<IUpdateTrigger> _updateTriggers = [];
|
||||
private readonly List<ILedGroup> _ledGroups = [];
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -68,7 +68,7 @@ public sealed class CustomUpdateData : ICustomUpdateData
|
||||
/// <returns>The value represented by the specified key.</returns>
|
||||
public object? this[string key]
|
||||
{
|
||||
get => _data.TryGetValue(key, out object? data) ? data : default;
|
||||
get => _data.GetValueOrDefault(key);
|
||||
set => _data[key] = value;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user