Last active
March 7, 2017 20:28
-
-
Save a5ync/4afccf0515d61922229843fe77c5708c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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