Your parser would work if you will get ALL Arguments in loop like this:
Case "write"
Dim sAllArgs As String = ""
For Each arg In Arguments
sAllArgs = sAllArgs + arg + " "
Next
MsgBox(sAllArgs)
Now your class looks like this:
Public Class Command
Private _cmd As String
Private _args As String()
Public Property Arguments As String()
Get
Return _args
End Get
Set(ByVal value As String())
_args = value
End Set
End Property
Public ReadOnly Property CommandName As String
Get
Return CMD.Split(" ")(0)
End Get
End Property
Public Property CMD As String
Get
Return _cmd
End Get
Set(ByVal value As String)
Dim args(_cmd.Split(" ").Count - 1) As String
Dim i As Integer = 0
For Each arg As String In _cmd.Split(" ")
If i > 0 Then
args(i - 1) = arg
End If
i += 1
Next
_args = args
_cmd = value
End Set
End Property
Public Sub New(ByVal xcmd As String)
_cmd = xcmd
CMD = xcmd
End Sub
Public Sub ActivateCommand()
Select Case CommandName.ToLower
Case "write"
Dim sAllArgs As String = ""
For Each arg In Arguments
sAllArgs = sAllArgs + arg + " "
Next
MsgBox(sAllArgs)
End Select
End Sub
End Class
And the command simply:
Dim cmd As New Command(Dim cmd As New Command("write Hello World"))
cmd.ActivateCommand()
This seems to be what you want, don't you?