From 3784db3a6e17b0ec2a2708feff90a479505f3d44 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Mon, 3 Mar 2025 18:35:18 +0100 Subject: [PATCH] Update project to .NET 8 --- Commander.NET/Command.cs | 6 +++--- Commander.NET/CommandResult.cs | 12 +++--------- Commander.NET/Commander.NET.csproj | 2 +- Commander.Test/Commander.Test.csproj | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Commander.NET/Command.cs b/Commander.NET/Command.cs index aa4aca9..0802080 100644 --- a/Commander.NET/Command.cs +++ b/Commander.NET/Command.cs @@ -4,14 +4,14 @@ namespace Commander; public class Command { - internal readonly List subCommands = new(); + internal readonly List subCommands = []; public string[] Identifiers { get; set; } public Func Method { get; set; } public HelpText HelpText { get; set; } public Command() { - Identifiers = Array.Empty(); + Identifiers = []; HelpText = string.Empty; Method = new Func((_) => CommandResult.Success()); } @@ -80,7 +80,7 @@ public class Command string[] inputParts = input.Split(' '); bool found = false; - commandResults ??= new List(); + commandResults ??= []; foreach (Command? command in subCommands.Where(command => command.Identifiers.Contains(inputParts[0]))) { diff --git a/Commander.NET/CommandResult.cs b/Commander.NET/CommandResult.cs index ac07ad9..b8a7b20 100644 --- a/Commander.NET/CommandResult.cs +++ b/Commander.NET/CommandResult.cs @@ -1,15 +1,9 @@ namespace Commander; -public class CommandResult +public class CommandResult(ResultType type, string message = "") { - public ResultType ResultType { get; } - public string Message { get; } - - public CommandResult(ResultType type, string message = "") - { - ResultType = type; - Message = message; - } + public ResultType ResultType { get; } = type; + public string Message { get; } = message; public static CommandResult Success(string message = "") { diff --git a/Commander.NET/Commander.NET.csproj b/Commander.NET/Commander.NET.csproj index af75738..d83c44a 100644 --- a/Commander.NET/Commander.NET.csproj +++ b/Commander.NET/Commander.NET.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable True diff --git a/Commander.Test/Commander.Test.csproj b/Commander.Test/Commander.Test.csproj index 1bc5fe9..720e626 100644 --- a/Commander.Test/Commander.Test.csproj +++ b/Commander.Test/Commander.Test.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable False