Skip to content

Instantly share code, notes, and snippets.

@kevinblake
Created October 24, 2013 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinblake/7137541 to your computer and use it in GitHub Desktop.
Save kevinblake/7137541 to your computer and use it in GitHub Desktop.
Get resources static helper class
public static class ResourceFinder
{
public static string Get(string resourceName)
{
var assembly = Assembly.GetExecutingAssembly();
var result = String.Empty;
using (var stream = assembly.GetManifestResourceStream(resourceName))
{
if (stream == null)
{
return result;
}
using (var reader = new StreamReader(stream))
{
result = reader.ReadToEnd();
}
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment