简体   繁体   中英

C# Equivalent for the VB.NET ReadFile function

I have the following in VB.Net

ReadFile(HidDevice, ReadBuffer(0), (long)(Capabilities.InputReportByteLength), NumberOfBytesToRead, 0);

Was wondering what is the equivalent method in C#?

 using (System.IO.StreamReader streamReader = new System.IO.StreamReader("file location"))
        {
            string content = streamReader.ReadToEnd();
        }

OR

 using (System.IO.FileStream fileStream = new System.IO.FileStream("file location", System.IO.FileMode.Open))
        {
            byte[] content = new byte[fileStream.Length];
            fileStream.Read(content, 0, content.Length);
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM