Click here to Skip to main content
15,891,375 members
Articles / DevOps / Testing

Include a binary file in your source code as a byte array

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
3 Jul 2011CPOL 9.8K  
You can also use the method in the following article to insert any sort of binary file in your project resources and retrieve it. Create a blank Jet database[^]

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
30 Jun 2011isaks 1 alternative  
A small method that reads a binary file from disk and creates valid byte[] declaration with the content of that file which you can then copy & paste into your application. This can be useful in unit tests if you need to feed binary data to the tested method.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Comport Computing
United States United States
I am a software developer specializing in technical and numerical software systems and also a PhD Petroleum Engineer.
I started programming in IBM 1620 machine code in 1967, then FORTAN on CDC mainframes mainframes in 1970. I later used ALGOL, BASIC, FORTH, Pascal,Prolog, C, F#, C#, etc.
I generally use whatever language available thatallows me to accomplish what is neccesary.

Comments and Discussions