Skip to content

Instantly share code, notes, and snippets.

@a5ync
Last active March 7, 2017 20:28
Show Gist options
  • Save a5ync/4afccf0515d61922229843fe77c5708c to your computer and use it in GitHub Desktop.
Save a5ync/4afccf0515d61922229843fe77c5708c to your computer and use it in GitHub Desktop.
class ResourceHelper
{
public static string GetScriptFromResources(string resourceName)
{
var assembly = Assembly.GetExecutingAssembly();
string scriptBody = null;
//lists all the embedded resources
//var resources = assembly.GetManifestResourceNames();
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
scriptBody = reader.ReadToEnd();
}
return scriptBody;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment