Struct CommandGroup
Represents a hierarchical command group (e.g., ["admin", "money", "give"]). Command groups provide a namespace for commands.
public readonly struct CommandGroup : IEquatable<CommandGroup>
- Implements
- Inherited Members
Constructors
CommandGroup(IEnumerable<string>)
Initializes a new instance from a collection of group parts.
public CommandGroup(IEnumerable<string> parts)
Parameters
partsIEnumerable<string>
CommandGroup(params string[])
Initializes a new instance from an ordered sequence of group parts.
public CommandGroup(params string[] parts)
Parameters
partsstring[]
Properties
Depth
The number of parts in this command group.
public int Depth { get; }
Property Value
FullName
The full command group as a space-separated string (e.g., "admin money").
public string FullName { get; }
Property Value
Parts
The ordered parts of this command group (e.g., ["admin", "money"]).
public IReadOnlyList<string> Parts { get; }
Property Value
Methods
Equals(CommandGroup)
public bool Equals(CommandGroup other)
Parameters
otherCommandGroup
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetParent(int)
Gets a subgroup with the first N parts (e.g., depth 1 of ["admin", "money"] = ["admin"]).
public CommandGroup GetParent(int depth)
Parameters
depthint
Returns
Stack(CommandGroup)
Stacks this group with another, returning a new group with combined parts.
public CommandGroup Stack(CommandGroup other)
Parameters
otherCommandGroup
Returns
Stack(string)
Stacks this group with a single part.
public CommandGroup Stack(string part)
Parameters
partstring
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(CommandGroup, CommandGroup)
Determines whether two command groups are equal.
public static bool operator ==(CommandGroup left, CommandGroup right)
Parameters
leftCommandGroupThe first command group to compare.
rightCommandGroupThe second command group to compare.
Returns
- bool
True if the command groups are equal; otherwise, false.
operator !=(CommandGroup, CommandGroup)
Determines whether two command groups are not equal.
public static bool operator !=(CommandGroup left, CommandGroup right)
Parameters
leftCommandGroupThe first command group to compare.
rightCommandGroupThe second command group to compare.
Returns
- bool
True if the command groups are not equal; otherwise, false.