Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# loading binary files

Tags:

c#

io

binaryfiles

Please show me the best/fast methods for:

1) Loading very small binary files into memory. For example icons;

2) Loading/reading very big binary files of size 512Mb+.

3) Your common choice when you do not want to think about size/speed but must do only thing: read all bytes into memory?

Thank you!!!

P.S. Sorry for maybe trivial question. Please do not close it;)

P.S.2. Mirror of analog question for Java;

like image 400
Edward83 Avatar asked Oct 15 '25 23:10

Edward83


1 Answers

1: For very small files File.ReadAllBytes will be fine.

2: For very big files and using .net 4.0 , you can make use MemoryMapped Files.

3: If Not using .net 4.0 than , reading chunks of data would be good choice

like image 85
TalentTuner Avatar answered Oct 18 '25 15:10

TalentTuner