public static Uint64ToByteStreamLe ( ulong val, Stream stream ) : void | ||
val | ulong | |
stream | Stream | |
return | void |
public static void Uint64ToByteStreamLe(ulong val, Stream stream)
{
var bytes = BitConverter.GetBytes(val);
if (!BitConverter.IsLittleEndian)
{
Array.Reverse(bytes);
}
stream.Write(bytes);
}
/// <exception cref="IOException"/> public override void BitcoinSerializeToStream(Stream stream) { Debug.Assert(_scriptBytes != null); Utils.Uint64ToByteStreamLe(Value, stream); // TODO: Move script serialization into the Script class, where it belongs. stream.Write(new VarInt((ulong)_scriptBytes.Length).Encode()); stream.Write(_scriptBytes); }