C#等效于VB.NET ReadFile函数

  • 本文关键字:NET ReadFile 函数 VB c#
  • 更新时间 :
  • 英文 :


我在VB.Net中有以下内容

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

想知道C#中的等效方法是什么?

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

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);
}

最新更新