Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - can binary data be compiled into a module?

Tags:

c#

binary-data

I want to include a large look-up table (100,000 of 3-byte values) inside a C# module.

Is there a compiler directive that will load binary data from an external file into a static string ?

like image 825
Martin Avatar asked Aug 03 '26 01:08

Martin


1 Answers

Why not just include the file into the assembly as an embedded resource, and then load it using Assembly.GetManifestResourceStream? Then just load it from the stream into whatever in-memory data structure you want.

like image 117
Jon Skeet Avatar answered Aug 05 '26 13:08

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!