ファイルを見つけて作成されたURLが必要で、そのファイルのURLを取得できます。これを取得します。
"C:\\dev\\vsprojects\\MvcApplication4\\MvcApplication4\\hard.txt"
すべてがうまく機能していて、を置き換えると問題が発生\\
します\
が、機能しません!コードは次のとおりです。
string ruta = "";
foreach (var readText in
Directory.GetFiles(@"C:\dev\vsprojects\MvcApplication4\MvcApplication4",
"stringCon.txt", SearchOption.AllDirectories))
{
ruta = readText;
}
ruta = ruta.Replace(@"\\", @"\");
//in debugger mode says ruta parameter still having
//the \\ and i cant get the content of the txt file
TextReader ReadTXT_file = new StreamReader(ruta);
//and here says that StringConexion is null, why??
string StringConexion = ReadTXT_file.ReadLine();
ReadTXT_file.Close();