Created
October 24, 2013 13:41
-
-
Save kevinblake/7137541 to your computer and use it in GitHub Desktop.
Get resources static helper class
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
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