From 99c08f33ed79c15bcf85ec3742bd3a8c17d5c1f9 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 30 Nov 2022 18:03:00 +0000 Subject: [PATCH] Use IReadOnlyList instead of T[] for public API --- VpSharp.Commands/Command.cs | 4 ++-- VpSharp.Commands/CommandsExtension.cs | 4 ++-- VpSharp.Commands/CommandsExtensionConfiguration.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VpSharp.Commands/Command.cs b/VpSharp.Commands/Command.cs index dc1e4e0..8928b75 100644 --- a/VpSharp.Commands/Command.cs +++ b/VpSharp.Commands/Command.cs @@ -8,10 +8,10 @@ namespace VpSharp.Commands; /// public sealed class Command { - internal Command(string name, string[] aliases, MethodInfo method, CommandModule module) + internal Command(string name, IReadOnlyList aliases, MethodInfo method, CommandModule module) { Name = name; - Aliases = new ReadOnlyCollection(aliases); + Aliases = aliases; Method = method; Module = module; Parameters = method.GetParameters()[1..]; diff --git a/VpSharp.Commands/CommandsExtension.cs b/VpSharp.Commands/CommandsExtension.cs index 1d799e9..3009cee 100644 --- a/VpSharp.Commands/CommandsExtension.cs +++ b/VpSharp.Commands/CommandsExtension.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using VpSharp.ClientExtensions; using VpSharp.Commands.Attributes; using VpSharp.EventData; @@ -256,7 +256,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension var command = new Command( commandAttribute.Name, - aliasesAttribute?.Aliases ?? Array.Empty(), + aliasesAttribute?.Aliases ?? ArraySegment.Empty, methodInfo, module ); diff --git a/VpSharp.Commands/CommandsExtensionConfiguration.cs b/VpSharp.Commands/CommandsExtensionConfiguration.cs index f9e75cf..e023c04 100644 --- a/VpSharp.Commands/CommandsExtensionConfiguration.cs +++ b/VpSharp.Commands/CommandsExtensionConfiguration.cs @@ -9,5 +9,5 @@ public sealed class CommandsExtensionConfiguration /// Gets or sets the prefixes to be use for commands. /// /// The command prefixes, as an array of values. - public string[] Prefixes { get; set; } = Array.Empty(); + public IReadOnlyList Prefixes { get; set; } = Array.Empty(); }