My code:
public static void DoStrumienia (string pString, Stream pStream)
{
if (pStream == null) throw new ArgumentNullException ();
BinaryWriter bw = new BinaryWriter (pStream);
int rozmiar = pString.Length;
bw.Write (rozmiar);
for (int i = 0; i < rozmiar; i++)
{
bw.Write (pString[i]);
}
bw.Flush ();
}
It writes string to a stream, but it writes using UTF8 encoding. How to it with UTF16?