In a C#.NET console application, the string[] args
that Main
takes already takes care of quoted parameters when those params are quoted with doublequotes; for example, the following commandline:
MyProgram.exe A "B C D" E
... will result in only 3 entries in args
. However when using single quotes instead:
MyProgram.exe A 'B C D' E
... then args
will have 5 entries. The single quotes haven't turned B C D
into a single parameter.
Is there a way of getting .NET to also treat single quotes as valid commandline argument quoting characters, or does this require a special commandline argument parsing library?