I want to know what is the Java DataInputStream class equivalent in C#
DataInputStream class Equivalent in C#
Asked Answered
You are looking for BinaryReader:
var reader = new BinaryReader(myStream);
var value = reader.ReadInt32();
there's no direct equivalent; but if you want to read data from console input, you can use Console.Read(), Console.ReadKey() or Console.ReadLine()
.NET Console Methods: http://msdn.microsoft.com/en-us/library/yz3fhfz1.aspx
If you want to read data from other sources, use an appropriate object that inherits from the System.IO.Stream class. There's FileStream, MemoryStream, NetworkStream, etc.
© 2022 - 2024 — McMap. All rights reserved.