У меня есть определяемая пользователем строка с именем fileNameArrayEdited, которая содержит "\\windows". Приведенный ниже оператор if не выполняется.
if (fileNameArrayEdited.StartsWith("\\"))
{
specifiedDirCount = specifiedDirCount + 1;
}
// Put all file names in root directory into array.
string[] fileNameArray = Directory.GetFiles(@specifiedDir);
int specifiedDirCount = specifiedDir.Count();
string fileNameArrayEdited = specifiedDir.Remove(0, specifiedDirCount);
Console.WriteLine(specifiedDir.Remove(0, specifiedDirCount));
if (fileNameArrayEdited.StartsWith(@"\\"))
{
specifiedDirCount = specifiedDirCount + 1;
Console.ReadLine();
}
Подробнее здесь: https://stackoverflow.com/questions/209 ... in-c-sharp