Click here to Skip to main content
15,891,529 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.
4.57/5 (4 votes)
30 Jun 2011CPOL 32K   5  
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.

Views

Daily Counts

License

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


Written By
Software Developer ABB
Sweden Sweden
My name is Isak Savo and I work as a Research Engineer at ABB Corporate Research in Västerås, Sweden. My work is focused around user experience which includes a lot of prototyping of new solutions for user interfaces and user interaction.

While I have a background in C programming in a Linux environment, my daily work is mostly spent in Windows using C# and WPF.

Comments and Discussions