Odczyt dużego pliku przy użyciu bajtu [] daje błąd [duplikat]
Możliwy duplikat:
Hash SHA1 dużych plików (ponad 2 GB) w C #
Mam duży plik wielkości terminów i daje mi błąd „Wyrzucono wyjątek typu„ System.OutOfMemoryException ”.
Każdy ma pomysł lub rozwiązanie problemu. Proszę pomóż. Przykładowy kod....
private string GetSha1()
{
string filePath = txtFileName.Text;
byte[] filebytes = System.IO.File.ReadAllBytes(filePath);
byte[] hashValue;
SHA1Managed hashString = new SHA1Managed();
string hex = "";
hashValue = hashString.ComputeHash(filebytes);
foreach (byte x in hashValue)
{
hex += String.Format("{0:x2}", x);
}
return hex;
}
W wierszu poniżej w powyższym kodzie otrzymuję wyjątek ....
byte[] filebytes = System.IO.File.ReadAllBytes(filePath);
Plik filePath ma plik o rozmiarze> 500 MB.