Getting an embedded resource out of the assembly + convert to bytearray
Uncategorized December 7th, 2009My file is located under /images/donkey.jpg, so in that case, don’t forget to add .images.
1 2 3 4 5 6 | var assemblyName = typeof(BinaryAssetFileDataProviderTest).Assembly.GetName().Name; var str = typeof (BinaryAssetFileDataProviderTest).Assembly.GetManifestResourceStream(assemblyName + ".images." + "donkey.jpg"); var blob = new byte[str.Length]; str.Read(blob, 0, (int)str.Length); var size = (int)str.Length; str.Close(); |
No TweetBacks yet. (Be the first to Tweet this post)
Follow Me!