Fix IDE0090

This commit is contained in:
RoosterDragon
2023-04-05 19:34:12 +01:00
committed by Pavel Penev
parent 164abfdae1
commit 8a285f9b19
385 changed files with 790 additions and 794 deletions

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Primitives
/// </summary>
public class ActionQueue
{
readonly List<DelayedAction> actions = new List<DelayedAction>();
readonly List<DelayedAction> actions = new();
public void Add(Action a, long desiredTime)
{

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Primitives
{
static class BitSetAllocator<T> where T : class
{
static readonly Cache<string, BitSetIndex> Bits = new Cache<string, BitSetIndex>(Allocate);
static readonly Cache<string, BitSetIndex> Bits = new(Allocate);
static BitSetIndex nextBits = 1;
static BitSetIndex Allocate(string value)

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Primitives
{
static class LongBitSetAllocator<T> where T : class
{
static readonly Cache<string, long> Bits = new Cache<string, long>(Allocate);
static readonly Cache<string, long> Bits = new(Allocate);
static long nextBits = 1;
static long Allocate(string value)

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Primitives
{
public readonly struct Polygon
{
public static readonly Polygon Empty = new Polygon(Rectangle.Empty);
public static readonly Polygon Empty = new(Rectangle.Empty);
public readonly Rectangle BoundingRect;
public readonly int2[] Vertices;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Primitives
/// </summary>
public abstract class ReadOnlyAdapterStream : Stream
{
readonly Queue<byte> data = new Queue<byte>(1024);
readonly Queue<byte> data = new(1024);
readonly Stream baseStream;
bool baseStreamEmpty;

View File

@@ -63,13 +63,13 @@ namespace OpenRA.Primitives
public int Top => Y;
public int Bottom => Y + Height;
public bool IsEmpty => X == 0 && Y == 0 && Width == 0 && Height == 0;
public int2 Location => new int2(X, Y);
public Size Size => new Size(Width, Height);
public int2 Location => new(X, Y);
public Size Size => new(Width, Height);
public int2 TopLeft => Location;
public int2 TopRight => new int2(X + Width, Y);
public int2 BottomLeft => new int2(X, Y + Height);
public int2 BottomRight => new int2(X + Width, Y + Height);
public int2 TopRight => new(X + Width, Y);
public int2 BottomLeft => new(X, Y + Height);
public int2 BottomRight => new(X + Width, Y + Height);
public bool Contains(int x, int y)
{

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Primitives
{
readonly int rows, cols, binSize;
readonly Dictionary<T, Rectangle>[] itemBoundsBins;
readonly Dictionary<T, Rectangle> itemBounds = new Dictionary<T, Rectangle>();
readonly Dictionary<T, Rectangle> itemBounds = new();
readonly Action<Dictionary<T, Rectangle>, T, Rectangle> addItem = (bin, actor, bounds) => bin.Add(actor, bounds);
readonly Action<Dictionary<T, Rectangle>, T, Rectangle> removeItem = (bin, actor, bounds) => bin.Remove(actor);

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Primitives
public class TypeDictionary : IEnumerable
{
static readonly Func<Type, List<object>> CreateList = type => new List<object>();
readonly Dictionary<Type, List<object>> data = new Dictionary<Type, List<object>>();
readonly Dictionary<Type, List<object>> data = new();
public void Add(object val)
{

View File

@@ -76,7 +76,7 @@ namespace OpenRA
public override string ToString() { return X + "," + Y; }
public static readonly float2 Zero = new float2(0, 0);
public static readonly float2 Zero = new(0, 0);
public static bool WithinEpsilon(float2 a, float2 b, float e)
{

View File

@@ -20,7 +20,7 @@ namespace OpenRA
public readonly struct float3 : IEquatable<float3>
{
public readonly float X, Y, Z;
public float2 XY => new float2(X, Y);
public float2 XY => new(X, Y);
public float3(float x, float y, float z) { X = x; Y = y; Z = z; }
public float3(float2 xy, float z) { X = xy.X; Y = xy.Y; Z = z; }
@@ -60,7 +60,7 @@ namespace OpenRA
public override string ToString() { return $"{X},{Y},{Z}"; }
public static readonly float3 Zero = new float3(0, 0, 0);
public static readonly float3 Ones = new float3(1, 1, 1);
public static readonly float3 Zero = new(0, 0, 0);
public static readonly float3 Ones = new(1, 1, 1);
}
}

View File

@@ -59,7 +59,7 @@ namespace OpenRA
public static int2 Max(int2 a, int2 b) { return new int2(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y)); }
public static int2 Min(int2 a, int2 b) { return new int2(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y)); }
public static readonly int2 Zero = new int2(0, 0);
public static readonly int2 Zero = new(0, 0);
public float2 ToFloat2() { return new float2(X, Y); }
// Change endianness of a uint32