Fix IDE0057

This commit is contained in:
RoosterDragon
2023-04-05 19:12:33 +01:00
committed by Pavel Penev
parent 5254348819
commit 023d80b94d
42 changed files with 104 additions and 104 deletions

View File

@@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
var localEnums = new List<Type>();
foreach (var init in actorInits)
{
var name = init.Name.Substring(0, init.Name.Length - 4);
var name = init.Name[..^4];
var parameters = init.GetConstructors().Select(ci => ci.GetParameters());
var parameterString = string.Join(" | ",
parameters

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
.Select(type => new
{
type.Namespace,
Name = type.Name.EndsWith("Info") ? type.Name.Substring(0, type.Name.Length - 4) : type.Name,
Name = type.Name.EndsWith("Info") ? type.Name[..^4] : type.Name,
Description = string.Join(" ", Utility.GetCustomAttributes<DescAttribute>(type, false).SelectMany(d => d.Lines)),
RequiresTraits = RequiredTraitTypes(type)
.Select(y => y.Name),
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
.Select(a =>
{
var name = a.AttributeType.Name;
name = name.EndsWith("Attribute") ? name.Substring(0, name.Length - 9) : name;
name = name.EndsWith("Attribute") ? name[..^9] : name;
return new
{

View File

@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
.Select(type => new
{
type.Namespace,
Name = type.Name.EndsWith("Info") ? type.Name.Substring(0, type.Name.Length - 4) : type.Name,
Name = type.Name.EndsWith("Info") ? type.Name[..^4] : type.Name,
Description = string.Join(" ", Utility.GetCustomAttributes<DescAttribute>(type, false).SelectMany(d => d.Lines)),
InheritedTypes = type.BaseTypes()
.Select(y => y.Name)
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
.Select(a =>
{
var name = a.AttributeType.Name;
name = name.EndsWith("Attribute") ? name.Substring(0, name.Length - 9) : name;
name = name.EndsWith("Attribute") ? name[..^9] : name;
return new
{

View File

@@ -231,7 +231,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
static string Truncate(string s, int maxLength)
{
return s.Length <= maxLength ? s : s.Substring(0, maxLength);
return s.Length <= maxLength ? s : s[..maxLength];
}
static string GetTileset(IniSection mapSection)