Last active
May 2, 2016 14:27
-
-
Save dhcgn/2bf72a270ed19447d67e7026a912a9bb to your computer and use it in GitHub Desktop.
This file contains 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 byte[] ExtractResource(string filename) | |
{ | |
var assembly = Assembly.GetExecutingAssembly(); | |
var name = assembly.GetManifestResourceNames().Single(s => s.EndsWith(filename)); | |
var stream = assembly.GetManifestResourceStream(name); | |
var ms = new MemoryStream(); | |
stream.CopyTo(ms); | |
return ms.ToArray(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment