簡體   English   中英

C# 等效於 VB.NET ReadFile 函數

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM