Skip to content

Instantly share code, notes, and snippets.

@felipeslongo
Created March 28, 2019 20:25
Show Gist options
  • Save felipeslongo/3761984cd5be3bad7860c4a36e837bb3 to your computer and use it in GitHub Desktop.
Save felipeslongo/3761984cd5be3bad7860c4a36e837bb3 to your computer and use it in GitHub Desktop.
Loads files with Build Action set to EmbeddedResource.
using System.IO;
using System.Reflection;
namespace Core.Utils
{
public static class EmbeddedResource
{
public static string ReadString(Assembly assembly, string @namespace ,string filename)
{
var stream = assembly.GetManifestResourceStream($"{@namespace}.{filename}");
var data = string.Empty;
using (var reader = new StreamReader(stream))
data = reader.ReadToEnd();
return data;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment