Use IReadOnlyList<T> instead of T[] for public API

This commit is contained in:
Oliver Booth 2022-11-30 18:03:00 +00:00
parent 86458129b5
commit 99c08f33ed
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
3 changed files with 5 additions and 5 deletions

View File

@ -8,10 +8,10 @@ namespace VpSharp.Commands;
/// </summary> /// </summary>
public sealed class Command public sealed class Command
{ {
internal Command(string name, string[] aliases, MethodInfo method, CommandModule module) internal Command(string name, IReadOnlyList<string> aliases, MethodInfo method, CommandModule module)
{ {
Name = name; Name = name;
Aliases = new ReadOnlyCollection<string>(aliases); Aliases = aliases;
Method = method; Method = method;
Module = module; Module = module;
Parameters = method.GetParameters()[1..]; Parameters = method.GetParameters()[1..];

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
using VpSharp.ClientExtensions; using VpSharp.ClientExtensions;
using VpSharp.Commands.Attributes; using VpSharp.Commands.Attributes;
using VpSharp.EventData; using VpSharp.EventData;
@ -256,7 +256,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension
var command = new Command( var command = new Command(
commandAttribute.Name, commandAttribute.Name,
aliasesAttribute?.Aliases ?? Array.Empty<string>(), aliasesAttribute?.Aliases ?? ArraySegment<string>.Empty,
methodInfo, methodInfo,
module module
); );

View File

@ -9,5 +9,5 @@ public sealed class CommandsExtensionConfiguration
/// Gets or sets the prefixes to be use for commands. /// Gets or sets the prefixes to be use for commands.
/// </summary> /// </summary>
/// <value>The command prefixes, as an array of <see cref="string" /> values.</value> /// <value>The command prefixes, as an array of <see cref="string" /> values.</value>
public string[] Prefixes { get; set; } = Array.Empty<string>(); public IReadOnlyList<string> Prefixes { get; set; } = Array.Empty<string>();
} }