Skip to content

A quick tool if you want to internalize a file declaring it as a byte array variable instead of a resource declaration in C# code

License

Notifications You must be signed in to change notification settings

Sammuel-Miranda/ByteArrayToCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ByteArrayToCode

A quick tool if you want to internalize a file declaring it as a byte array variable instead of a resource declaration in C# code


Sometimes instead of adding a file (usually a small one) as a resource file, implementing the RESX via a StronglyTypedResourceBuilder as allowed be the Visual Studio Resource Manager, i prefer to declare a static function that would return the array of bytes (for any particular reason). This simple piece of code is intended to do just that.

The "ToCode(params)" functions will return a string containing "return new byte[] { 0, 0, [...] 0 };" (with Ident options, line breaks after a N number of bytes on a line and decoration options - printing 000 pattern instead of default ToString() method) that can be copied at a source code file to serve as the returned byte array.

About

A quick tool if you want to internalize a file declaring it as a byte array variable instead of a resource declaration in C# code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages