Embedded Resource
De Banane Atomic
Aller à la navigationAller à la recherche
Lire le contenu d'une ressource embarquée
var assembly = Assembly.GetExecutingAssembly(); var resourceName = "MyCompany.MyProduct.MyFile.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { string content = reader.ReadToEnd(); } |
MyProduct → Nom du projet |