I want to know what is the Java DataInputStream class equivalent in C#
Asked
Active
Viewed 7,485 times
2 Answers
11
You are looking for BinaryReader:
var reader = new BinaryReader(myStream);
var value = reader.ReadInt32();

jgauffin
- 99,844
- 45
- 235
- 372
-2
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.

KBoek
- 5,794
- 5
- 32
- 49