When we create a byte array like this:
byte[] fileData = System.IO.File.ReadAllBytes("FileName.exe");
Will the size of the file take up the memory?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The File.ReadAllBytes method is implemented in a pretty obvious way. It uses the using resource acquisition block on a FileStream. Then, it loops through the file and puts the bytes into a byte array. In the .NET Framework 4.0, it will throw an exception if the file exceeds 2 gigabytes.
http://www.dotnetperls.com/file-readallbytes