Back to "Ще один короткий... як прочитати вміст цілого файла у масив Bate..."

This is a viewer only at the moment see the article on how this works.

To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk

This is a preview from the server running through my markdig pipeline

Imported mostlylucidcouk

Ще один короткий... як прочитати вміст цілого файла у масив Bate...

Sunday, 04 July 2004

Це лише один із тихих тупих маленьких фрагментів, які я завжди забуваю і є трохи безглуздим, щоб знайти... так, якщо ви з якоїсь причини (наприклад, стиснення / шифрування) потребує весь вміст файла, що зберігається у масиві байтів, ось найпростіший спосіб, яким я знайшов зробити це:

byte[] inArrr; Використовується }Stream s=File. open} "myfile. dat", FileMode.Open) { inArr = новий байт[s. Length];

  1. Reading}inArr, 0, inArr.Length); }
logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.