c# - read the content of file by getting it from dll - Stack Overflow

PHOTO EMBED

Tue Jan 24 2023 20:07:27 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio #cs

    public static string GetResourceFileContentAsString(string fileName)
    {
        var assembly = Assembly.GetExecutingAssembly();
        var resourceName = "Your.Namespace." + fileName;

        string resource = null;
        using (Stream stream = assembly.GetManifestResourceStream(resourceName))
        {
            using (StreamReader reader = new StreamReader(stream))
            {
                resource = reader.ReadToEnd();
            }
        }
        return resource;
    }
content_copyCOPY

https://stackoverflow.com/questions/27835301/read-the-content-of-file-by-getting-it-from-dll