Now I have several classes in the class:
string upgrade_file
= new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(
Assembly.GetExecutingAssembly().GetName().Name
+ ".schemas.template.db_upgrades.txt")
).ReadToEnd();
I can write a wrapper function to simplify access to embedded resources (and I will, if necessary), but is there an easier or more elegant way to access them using .Net?
For example, it seems strange to me that GetManifestResourceStream (...) is not static. Another example: is there some method that returns a string and not a stream for text files?
UPDATE 1 :
To be clear, I have text files in subdirectories, and I want to:
- These files remain separate files (for example, so that they can be controlled separately)
- These files remain embedded resources, that is, compiled using the assembly.
, :

2:
- , .
, , - :
static string GetEmbeddedTextFile(string resource)
{
return new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(
Assembly.GetExecutingAssembly().GetName().Name + "." + resource)).ReadToEnd();
}
user610650