Fixed unnecessary zero-length array allocations

Changed all currently present zero-length array allocations in the codebase to use `Array.Empty` instead.
This commit is contained in:
penev92
2022-01-09 21:32:25 +02:00
committed by abcdefg30
parent 1312c1aa72
commit 0d24ccc47a
28 changed files with 45 additions and 34 deletions

View File

@@ -24,8 +24,8 @@ namespace OpenRA.Graphics
readonly Dictionary<string, ImmutablePalette> palettes = new Dictionary<string, ImmutablePalette>();
readonly Dictionary<string, MutablePalette> mutablePalettes = new Dictionary<string, MutablePalette>();
readonly Dictionary<string, int> indices = new Dictionary<string, int>();
byte[] buffer = new byte[0];
float[] colorShiftBuffer = new float[0];
byte[] buffer = Array.Empty<byte>();
float[] colorShiftBuffer = Array.Empty<float>();
public HardwarePalette()
{

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using OpenRA.Primitives;
@@ -16,7 +17,7 @@ namespace OpenRA.Graphics
{
public class SpriteRenderable : IPalettedRenderable, IModifyableRenderable, IFinalizedRenderable
{
public static readonly IEnumerable<IRenderable> None = new IRenderable[0];
public static readonly IEnumerable<IRenderable> None = Array.Empty<IRenderable>();
readonly Sprite sprite;
readonly WPos pos;