diff --git a/VpSharp.Commands/Attributes/AliasesAttribute.cs b/VpSharp.Commands/Attributes/AliasesAttribute.cs
index 9322285..57956c4 100644
--- a/VpSharp.Commands/Attributes/AliasesAttribute.cs
+++ b/VpSharp.Commands/Attributes/AliasesAttribute.cs
@@ -1,4 +1,6 @@
-namespace VpSharp.Commands.Attributes;
+using System.Collections.ObjectModel;
+
+namespace VpSharp.Commands.Attributes;
///
/// Defines the aliases of a command.
@@ -39,14 +41,15 @@ public sealed class AliasesAttribute : Attribute
}
}
- Aliases = new string[aliases.Length + 1];
- Aliases[0] = alias;
- Array.Copy(aliases, 0, Aliases, 1, aliases.Length);
+ var buffer = new string[aliases.Length + 1];
+ buffer[0] = alias;
+ Array.Copy(aliases, 0, buffer, 1, aliases.Length);
+ Aliases = new ReadOnlyCollection(buffer);
}
///
/// Gets the command aliases.
///
/// The command aliases.
- public string[] Aliases { get; }
+ public IReadOnlyList Aliases { get; }
}
diff --git a/VpSharp.Commands/Command.cs b/VpSharp.Commands/Command.cs
index 09600f3..dc1e4e0 100644
--- a/VpSharp.Commands/Command.cs
+++ b/VpSharp.Commands/Command.cs
@@ -1,4 +1,5 @@
-using System.Reflection;
+using System.Collections.ObjectModel;
+using System.Reflection;
namespace VpSharp.Commands;
@@ -10,7 +11,7 @@ public sealed class Command
internal Command(string name, string[] aliases, MethodInfo method, CommandModule module)
{
Name = name;
- Aliases = aliases[..];
+ Aliases = new ReadOnlyCollection(aliases);
Method = method;
Module = module;
Parameters = method.GetParameters()[1..];
@@ -20,7 +21,7 @@ public sealed class Command
/// Gets the aliases for this command.
///
/// The aliases.
- public string[] Aliases { get; }
+ public IReadOnlyList Aliases { get; }
///
/// Gets the name of this command.
diff --git a/VpSharp.Commands/CommandContext.cs b/VpSharp.Commands/CommandContext.cs
index 4a83e13..fb6ed1f 100644
--- a/VpSharp.Commands/CommandContext.cs
+++ b/VpSharp.Commands/CommandContext.cs
@@ -1,4 +1,5 @@
-using System.Drawing;
+using System.Collections.ObjectModel;
+using System.Drawing;
using VpSharp.Entities;
namespace VpSharp.Commands;
@@ -18,7 +19,7 @@ public sealed class CommandContext
CommandName = commandName;
Alias = alias;
RawArguments = rawArguments;
- Arguments = rawArguments.Split();
+ Arguments = new ReadOnlyCollection(rawArguments.Split());
}
///
@@ -31,7 +32,7 @@ public sealed class CommandContext
/// Gets the arguments of the command.
///
/// The arguments passed by the avatar.
- public string[] Arguments { get; }
+ public IReadOnlyList Arguments { get; }
///
/// Gets the avatar who executed the command.