johnc
johnc

Reputation: 40223

C# Storing Binary Stream (or byte Array) in Resources

I am guessing, as Images and Icons are stored in a resx file, I am guessing that it should be relatively easy to store a byte array (or similar stream) in an embedded Resource file.

How might this be done, should I pretend the binary stream is a Bitmap, or if the Resource file is the wrong place to be embedding binary data, what other techniques should I investigate?

Upvotes: 0

Views: 2428

Answers (1)

Sam Saffron
Sam Saffron

Reputation: 131112

Mitch has pointed to the right answer, but one trick you can keep up your sleeve is storing the data compressed and decompressing on first access. It helps keep your DLLs small. I use this trick to Embed X64 and X32 versions of a native dll:

See for example the code here: http://code.google.com/p/videobrowser/source/browse/trunk/MediaInfoProvider/LibraryLoader.cs

Upvotes: 1

Related Questions