Является ли следующее поведение некоторой функцией или ошибкой в С#.NET?
Тестирование:
using System;
using System.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Arguments:");
foreach (string arg in args)
{
Console.WriteLine(arg);
}
Console.WriteLine();
Console.WriteLine("Command Line:");
var clArgs = Environment.CommandLine.Split(' ');
foreach (string arg in clArgs.Skip(clArgs.Length - args.Length))
{
Console.WriteLine(arg);
}
Console.ReadKey();
}
}
}
Запустите его с аргументами командной строки:
a "b" "\\x\\" "\x\"
В результате получите:
Arguments:
a
b
\\x\
\x"
Command Line:
a
"b"
"\\x\\"
"\x\"
В аргументах, переданных методу Main(), отсутствуют обратные слэши и неотключенная цитата. Кто-нибудь знает о правильном обходном пути, кроме ручного разбора CommandLine?