private static void WriteHeaderField(BinaryWriter bwOut,
Kdb4HeaderFieldID kdbID, byte[] pbData)
{
Debug.Assert(bwOut != null);
if(bwOut == null) throw new ArgumentNullException("bwOut");
bwOut.Write((byte)kdbID);
if(pbData != null)
{
ushort uLength = (ushort)pbData.Length;
bwOut.Write(uLength);
if(uLength > 0) bwOut.Write(pbData);
}
else bwOut.Write((ushort)0);
}