Код: Выделить всё
namespace foo
{
public class Keys
{
public const string SubFolder= "bar";
public const string rootDir = Environment.GetEnvironmentVariable("buz");
}
}
Код: Выделить всё
namespace foo
{
public class FileLoader
{
public string FileName { get; }
public string FilePath { get; }
public XmlDocument FileXML { get; set; }
internal FileLoader(string _FileName)
{
this.FileName = _FileName; // "qux"
this.FilePath = Path.Combine(Keys.rootDir, Keys.SubFolder, this.FileName);
try
{
this.FileXml.Load(this.FilePath);
}
catch {throw new Exception($"Couldn't load {this.FileName} from path {this.FilePath}")}
}
}
содержит эти двойные обратные косые черты . Где я неправильно использую Path.Combine? Конечно, я мог бы заменить эти двойные обратные косые черты регулярным выражением на одну, но в этом нет реальной проблемы, верно?
Подробнее здесь: https://stackoverflow.com/questions/792 ... prone-path
Мобильная версия