load resource as byte array programmatically

katit picture katit · Feb 28, 2012 · Viewed 17.6k times · Source

I added image as file and set type as resource (see screenshot) How do I pull it out as byte array without using resx files, etc?

enter image description here

Answer

Gary Woodfine picture Gary Woodfine · Mar 13, 2013

Things are even simpler than the item markes as answer!

If you click on the file in resources and view the properties window, you can set the File Type to binary. Then you can access the bytearray in code with a simple

var byteArray = Properties.Resources.FileName;

where FileName is the name of your resource.