4

I want to know what is the Java DataInputStream class equivalent in C#

Andrew Orsich
  • 52,935
  • 16
  • 139
  • 134
saikamesh
  • 4,569
  • 11
  • 53
  • 93

2 Answers2

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