本文整理汇总了VB.NET中System.IO.BinaryReader.ReadChars方法的典型用法代码示例。如果您正苦于以下问题:VB.NET BinaryReader.ReadChars方法的具体用法?VB.NET BinaryReader.ReadChars怎么用?VB.NET BinaryReader.ReadChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadChars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: BinaryRW
' 导入命名空间
Imports System.IO
Public Class BinaryRW
Shared Sub Main()
Dim invalidPathChars() As Char = Path.InvalidPathChars
Dim memStream As new MemoryStream()
Dim binWriter As New BinaryWriter(memStream)
' Write to memory.
binWriter.Write("Invalid file path characters are: ")
binWriter.Write(Path.InvalidPathChars)
' Create the reader using the same MemoryStream
' as used with the writer.
Dim binReader As New BinaryReader(memStream)
' Set Position to the beginning of the stream.
memStream.Position = 0
' Read the data from memory and write it to the console.
Console.Write(binReader.ReadString())
Console.WriteLine(binReader.ReadChars( _
CInt(memStream.Length - memStream.Position)))
End Sub
End Class