CSharp examples for System.IO:BinaryReader
Read Unicode using BinaryReader
using System.Text; using System.IO;//w w w. j a va2s . c om using System; public class Main{ public static string ReadUnicode(this BinaryReader reader, int len) { byte[] unicode = reader.ReadBytes(len * 2); string text = Encoding.Unicode.GetString(unicode); text = text.Substring(0, text.IndexOf('\0')); return text; } }