diff --git a/OpenRA.Game/Scripting/ScriptMemberWrapper.cs b/OpenRA.Game/Scripting/ScriptMemberWrapper.cs index bd8e1e32f8d4..1c4a86ef5dd1 100644 --- a/OpenRA.Game/Scripting/ScriptMemberWrapper.cs +++ b/OpenRA.Game/Scripting/ScriptMemberWrapper.cs @@ -149,7 +149,7 @@ public static string[] RequiredTraitNames(Type t) // Remove the namespace and the trailing "Info" return types.SelectMany(i => i.GetGenericArguments()) - .Select(g => g.Name.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault()) + .Select(g => g.Name.Split('.', StringSplitOptions.RemoveEmptyEntries).LastOrDefault()) .Select(s => s.EndsWith("Info", StringComparison.Ordinal) ? s.Remove(s.Length - 4, 4) : s) .ToArray(); } diff --git a/OpenRA.Mods.Cnc/Traits/World/VoxelCache.cs b/OpenRA.Mods.Cnc/Traits/World/VoxelCache.cs index b1326788928a..2e07e7e26e42 100644 --- a/OpenRA.Mods.Cnc/Traits/World/VoxelCache.cs +++ b/OpenRA.Mods.Cnc/Traits/World/VoxelCache.cs @@ -64,7 +64,7 @@ IModel LoadVoxel(string unit, MiniYaml info) var hva = unit; if (info.Value != null) { - var fields = info.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var fields = info.Value.Split(',', StringSplitOptions.RemoveEmptyEntries); if (fields.Length >= 1) vxl = hva = fields[0].Trim(); diff --git a/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs b/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs index c9c21079d450..30263b408f98 100644 --- a/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs +++ b/OpenRA.Mods.Common/UtilityCommands/Rgba2Hex.cs @@ -17,7 +17,7 @@ sealed class Rgba2Hex : IUtilityCommand { string IUtilityCommand.Name => "--rgba2hex"; - static readonly char[] Comma = new char[] { ',' }; + const char Comma = ','; bool IUtilityCommand.ValidateArguments(string[] args) { @@ -105,7 +105,7 @@ sealed class Argb2Hex : IUtilityCommand { string IUtilityCommand.Name => "--argb2hex"; - static readonly char[] Comma = new char[] { ',' }; + const char Comma = ','; bool IUtilityCommand.ValidateArguments(string[] args) { diff --git a/OpenRA.Mods.Common/Widgets/LabelWithHighlightWidget.cs b/OpenRA.Mods.Common/Widgets/LabelWithHighlightWidget.cs index 9914c851858c..8c07afb34bb0 100644 --- a/OpenRA.Mods.Common/Widgets/LabelWithHighlightWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LabelWithHighlightWidget.cs @@ -39,7 +39,7 @@ protected LabelWithHighlightWidget(LabelWithHighlightWidget other) (string, bool)[] MakeComponents(string text) { var components = new List<(string, bool)>(); - foreach (var l in text.Split(new[] { "\\n" }, StringSplitOptions.None)) + foreach (var l in text.Split("\\n", StringSplitOptions.None)) { var line = l; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ButtonTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ButtonTooltipLogic.cs index 65933d696cb3..d554f605ad94 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ButtonTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ButtonTooltipLogic.cs @@ -50,7 +50,7 @@ public ButtonTooltipLogic(Widget widget, ButtonWidget button) var descFont = Game.Renderer.Fonts[descTemplate.Font]; var descWidth = 0; var descOffset = descTemplate.Bounds.Y; - foreach (var line in desc.Split(new[] { "\n" }, StringSplitOptions.None)) + foreach (var line in desc.Split('\n', StringSplitOptions.None)) { descWidth = Math.Max(descWidth, descFont.Measure(line).X); var lineLabel = (LabelWidget)descTemplate.Clone(); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs index 7f5166e7911e..c3432cae104f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/DownloadPackageLogic.cs @@ -304,7 +304,7 @@ void DownloadUrl(string url) var httpResponseMessage = await client.GetAsync(download.MirrorList); var result = await httpResponseMessage.Content.ReadAsStringAsync(); - var mirrorList = result.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); + var mirrorList = result.Split('\n', StringSplitOptions.RemoveEmptyEntries); DownloadUrl(mirrorList.Random(new MersenneTwister())); } catch (Exception e)