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

@@ -16,9 +16,9 @@ namespace OpenRA
{
public class Arguments
{
readonly Dictionary<string, string> args = new Dictionary<string, string>();
readonly Dictionary<string, string> args = new();
public static Arguments Empty => new Arguments();
public static Arguments Empty => new();
public Arguments(params string[] src)
{

View File

@@ -53,8 +53,8 @@ namespace OpenRA.Support
public class AssemblyLoadContextBuilder
{
readonly Dictionary<string, ManagedLibrary> managedLibraries = new Dictionary<string, ManagedLibrary>(StringComparer.Ordinal);
readonly Dictionary<string, NativeLibrary> nativeLibraries = new Dictionary<string, NativeLibrary>(StringComparer.Ordinal);
readonly Dictionary<string, ManagedLibrary> managedLibraries = new(StringComparer.Ordinal);
readonly Dictionary<string, NativeLibrary> nativeLibraries = new(StringComparer.Ordinal);
string basePath;
public AssemblyLoadContext Build()

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Support
class Benchmark
{
readonly string prefix;
readonly Dictionary<string, List<BenchmarkPoint>> samples = new Dictionary<string, List<BenchmarkPoint>>();
readonly Dictionary<string, List<BenchmarkPoint>> samples = new();
public Benchmark(string prefix)
{

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Support
}
static readonly Dictionary<string, int> Prec
= new Dictionary<string, int> { { "+", 0 }, { "-", 0 }, { "*", 1 }, { "/", 1 }, { "(", -1 } };
= new() { { "+", 0 }, { "-", 0 }, { "*", 1 }, { "/", 1 }, { "(", -1 } };
static IEnumerable<string> Tokens(string expr, string ops)
{

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Support
static readonly TimeSpan ConnectionLifeTime = TimeSpan.FromMinutes(1);
#endif
static readonly Lazy<HttpMessageHandler> Handler = new Lazy<HttpMessageHandler>(GetHandler);
static readonly Lazy<HttpMessageHandler> Handler = new(GetHandler);
public static HttpClient Create()
{

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Support
public class HttpQueryBuilder : IEnumerable
{
readonly string url;
readonly List<Parameter> parameters = new List<Parameter>();
readonly List<Parameter> parameters = new();
public HttpQueryBuilder(string url)
{

View File

@@ -41,10 +41,10 @@ namespace OpenRA
{
const int CreateLogFileMaxRetryCount = 128;
static readonly ConcurrentDictionary<string, ChannelInfo> Channels = new ConcurrentDictionary<string, ChannelInfo>();
static readonly ConcurrentDictionary<string, ChannelInfo> Channels = new();
static readonly Channel<ChannelData> Channel;
static readonly ChannelWriter<ChannelData> ChannelWriter;
static readonly CancellationTokenSource CancellationToken = new CancellationTokenSource();
static readonly CancellationTokenSource CancellationToken = new();
static readonly TimeSpan FlushInterval = TimeSpan.FromSeconds(5);
static readonly Timer Timer;

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Support
static int nextColor;
public static Cache<string, PerfItem> Items = new Cache<string, PerfItem>(
public static Cache<string, PerfItem> Items = new(
s =>
{
var x = new PerfItem(s, Colors[nextColor++]);

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Support
List<PerfTimer> children;
long ticks;
static readonly ThreadLocal<PerfTimer> ParentThreadLocal = new ThreadLocal<PerfTimer>();
static readonly ThreadLocal<PerfTimer> ParentThreadLocal = new();
public PerfTimer(string name, float thresholdMs = 0)
{

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Support
public static readonly IReadOnlyDictionary<string, int> NoVariables = new ReadOnlyDictionary<string, int>(new Dictionary<string, int>());
public readonly string Expression;
readonly HashSet<string> variables = new HashSet<string>();
readonly HashSet<string> variables = new();
public IEnumerable<string> Variables => variables;
enum CharClass { Whitespace, Operator, Mixed, Id, Digit }
@@ -716,8 +716,8 @@ namespace OpenRA.Support
class AstStack
{
readonly List<Expression> expressions = new List<Expression>();
readonly List<ExpressionType> types = new List<ExpressionType>();
readonly List<Expression> expressions = new();
readonly List<ExpressionType> types = new();
public ExpressionType PeekType() { return types[^1]; }
@@ -774,7 +774,7 @@ namespace OpenRA.Support
class Compiler
{
readonly AstStack ast = new AstStack();
readonly AstStack ast = new();
public Expression Build(Token[] postfix, ExpressionType resultType)
{