Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Something similar to text /endtext in C#
Message
De
12/04/2016 21:57:06
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01634710
Message ID:
01634726
Vues:
49
J'aime (1)
>I put that string into text file and added it to the test project in the solution. Then I used this code
>
>
> String text = System.IO.File.ReadAllText(@"TestPictureString.txt");
>
>but got file not found exception.
>
>How should I get the full path of this file which is currently included into a solution? I don't want to put the actual directory from my machine, I want this to be more generic.
>
>Thanks in advance.

Good question. I haven't found any good answers to it.
I put those paths in the app.config file, create a string and use that to access the file.
When I move the app to another machine, I have to remember to change the app.config.

Here's how I access it.
string ftpoutputfilename = ConfigurationManager.AppSettings["FTPFilepath"] + "ftpfile.txt";
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform