Back to "Ytterligare en kort... hur man läser innehållet i en hel fil i en Byte Array..."

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

Ytterligare en kort... hur man läser innehållet i en hel fil i en Byte Array...

Sunday, 04 July 2004

Detta bara en annan av thoise dumma små snippets som jag alltid glömmer och är lite av en bugger att hitta ... så, om du av någon anledning (t.ex. komprimering / kryptering) behöver allt innehåll i en fil för att hållas i en byte array, här är det enklaste sättet jag har hittat att göra det:

byte[) iArr; använda(Stream s=File.Open("myfile.dat",FileMode.Open)) { inArr = ny byte[s.Längd] S.Read(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.