Use collection expressions to create empty collections

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-20 23:06:22 +01:00
1 親 358f378796
コミット 8dc70916ac
13ファイル変更
+19 -19

検索条件に一致するファイルはありません

+1 -1
ファイルの表示
@@ -46,7 +46,7 @@
This is used eg. to replace Unsafe.SizeOf<T>() calls with just sizeof(T). The warning is not necessary
since in order to use these APIs the caller already has to be in an unsafe context.
-->
<NoWarn>$(NoWarn);CS8500;IDE0028;IDE0300;IDE0301;IDE0302</NoWarn>
<NoWarn>$(NoWarn);CS8500;IDE0300;IDE0301;IDE0302</NoWarn>
</PropertyGroup>
<!-- Centralized location for all generated artifacts -->
+1 -1
ファイルの表示
@@ -16,7 +16,7 @@ public sealed partial class MainWindow : Window
/// <summary>
/// The mapping of currently alive shader panels.
/// </summary>
private readonly ConditionalWeakTable<AnimatedComputeShaderPanel, object?> shaderPanels = new();
private readonly ConditionalWeakTable<AnimatedComputeShaderPanel, object?> shaderPanels = [];
public MainWindow()
{
+1 -1
ファイルの表示
@@ -17,7 +17,7 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
/// <remarks>
/// When not empty (ie. when an effect graph has been built), this will always also include <see cref="canvasImage"/>.
/// </remarks>
private readonly Dictionary<object, ICanvasImage> transformNodes = new();
private readonly Dictionary<object, ICanvasImage> transformNodes = [];
/// <summary>
/// The current cached result for <see cref="GetCanvasImage"/>, if available.
+1 -1
ファイルの表示
@@ -12,7 +12,7 @@ internal sealed class SemanticModelProvider(Compilation compilation)
/// <summary>
/// The map of loaded <see cref="SemanticModel"/> instances.
/// </summary>
private readonly Dictionary<SyntaxTree, SemanticModel> semanticModelsMap = new();
private readonly Dictionary<SyntaxTree, SemanticModel> semanticModelsMap = [];
/// <summary>
/// Gets a <see cref="SemanticModel"/> instance with info on a given <see cref="SyntaxNode"/>.
+1 -1
ファイルの表示
@@ -166,7 +166,7 @@ internal static partial class HlslKnownMethods
{
ILookup<string, MethodInfo> methodsLookup = typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static).ToLookup(static method => method.Name);
Dictionary<string, string> knownMethods = new();
Dictionary<string, string> knownMethods = [];
// Go through the previously discovered methods to find the ones requiring parameters mapping
foreach (KeyValuePair<string, string> pair in KnownMethods)
+1 -1
ファイルの表示
@@ -21,7 +21,7 @@ internal static partial class HlslKnownOperators
/// </summary>
private static IReadOnlyDictionary<string, string> BuildKnownOperatorsMap()
{
Dictionary<string, string> knownOperators = new();
Dictionary<string, string> knownOperators = [];
// Programmatically load mappings for the intrinsic operators on each HLSL primitive type
foreach ((Type Type, MethodInfo Operator, string IntrinsicName, bool RequiresParametersMatching) item in
+4 -4
ファイルの表示
@@ -87,8 +87,8 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
this.shaderType = shaderType;
this.staticMethods = staticMethods;
this.instanceMethods = instanceMethods;
this.localFunctions = new();
this.implicitVariables = new();
this.localFunctions = [];
this.implicitVariables = [];
this.isEntryPoint = isEntryPoint;
}
@@ -112,8 +112,8 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
{
this.staticMethods = staticMethods;
this.instanceMethods = instanceMethods;
this.implicitVariables = new();
this.localFunctions = new();
this.implicitVariables = [];
this.localFunctions = [];
}
/// <summary>
+1 -1
ファイルの表示
@@ -170,7 +170,7 @@ public sealed unsafe partial class GraphicsDevice : IReferenceTrackedObject
IsCacheCoherentUMA = d3D12Architecture1Data.CacheCoherentUMA != 0;
this.deviceRemovedReason = S.S_OK;
this.cachedPipelineData = new List<PipelineData>();
this.cachedPipelineData = [];
RegisterDeviceLostCallback(this, out this.deviceHandle, out this.deviceRemovedEvent, out this.deviceRemovedWaitHandle);
}
+2 -2
ファイルの表示
@@ -14,12 +14,12 @@ unsafe partial class DeviceHelper
/// <summary>
/// The local cache of <see cref="GraphicsDevice"/> instances that are currently usable.
/// </summary>
internal static readonly Dictionary<Luid, GraphicsDevice> DevicesCache = new();
internal static readonly Dictionary<Luid, GraphicsDevice> DevicesCache = [];
/// <summary>
/// The local map of <see cref="ID3D12InfoQueue"/> instances for the existing devices.
/// </summary>
private static readonly Dictionary<Luid, ComPtr<ID3D12InfoQueue>> D3D12InfoQueueMap = new();
private static readonly Dictionary<Luid, ComPtr<ID3D12InfoQueue>> D3D12InfoQueueMap = [];
/// <summary>
/// The cached default <see cref="GraphicsDevice"/> instance, if any.
+1 -1
ファイルの表示
@@ -19,7 +19,7 @@ internal static unsafe class PipelineDataLoader<T>
/// <summary>
/// The map of cached <see cref="PipelineData"/> instances for each GPU in use.
/// </summary>
private static readonly ConditionalWeakTable<GraphicsDevice, PipelineData> CachedPipelines = new();
private static readonly ConditionalWeakTable<GraphicsDevice, PipelineData> CachedPipelines = [];
/// <summary>
/// Gets the <see cref="PipelineData"/> instance for a given shader.
+3 -3
ファイルの表示
@@ -644,9 +644,9 @@ public partial class CanvasEffectTests
private static readonly EffectNode<DummyCanvasImageTrackingDisposal> EffectNode1 = new();
private static readonly EffectNode<DummyCanvasImageTrackingDisposal> EffectNode2 = new();
private static readonly EffectNode<DummyCanvasImageTrackingDisposal> EffectNode3 = new();
public readonly List<DummyCanvasImageTrackingDisposal> Effects1 = new();
public readonly List<DummyCanvasImageTrackingDisposal> Effects2 = new();
public readonly List<DummyCanvasImageTrackingDisposal> Effects3 = new();
public readonly List<DummyCanvasImageTrackingDisposal> Effects1 = [];
public readonly List<DummyCanvasImageTrackingDisposal> Effects2 = [];
public readonly List<DummyCanvasImageTrackingDisposal> Effects3 = [];
public void InvalidateCreation()
{
+1 -1
ファイルの表示
@@ -24,7 +24,7 @@ public class DeviceLostTests
{
GraphicsDeviceHelper.GetD3D12Device(graphicsDevice, in d3D12Device);
List<(object? Sender, DeviceLostEventArgs Args)> args = new();
List<(object? Sender, DeviceLostEventArgs Args)> args = [];
// Register the device lost callback
graphicsDevice.DeviceLost += (s, e) => args.Add((s, e));
+1 -1
ファイルの表示
@@ -17,7 +17,7 @@ internal struct DebugDispatchDataLoader : IConstantBufferLoader, IGraphicsResour
/// <summary>
/// The list of loaded resources.
/// </summary>
private readonly List<(IGraphicsResource Resource, uint Index)> graphicsResources = new();
private readonly List<(IGraphicsResource Resource, uint Index)> graphicsResources = [];
/// <summary>
/// Creates a new <see cref="DebugDispatchDataLoader"/> instance.