简体   繁体   English

C# 等效于 VB.NET ReadFile 函数

[英]C# Equivalent for the VB.NET ReadFile function

I have the following in VB.Net我在VB.Net有以下内容

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

Was wondering what is the equivalent method in C#?想知道 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);
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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