Convert UInt32 to Byte array

Hi,

I need to append a UInt32 to a MutableMemoryblock. To do this it looks like I need to append an array of bytes. Does anyone know how to convert a 4 byte UInt32 to an array of bytes?

Thanks,

Why not add four empty bytes and then use uint32Value?

Because I’m a fool. Doh. Thanks - that makes much more sense.

So If I want to add a single byte followed by an Int32, would this work?

[code]Dim start As Byte = &h25
Dim keyLength As UInt32 = mPublicKey.Size

Dim handshake As New Xojo.Core.MutableMemoryBlock(5)
handshake.Int8Value(0) = start
handshake.UInt32Value(1) = keyLength[/code]

[quote=418839:@Garry Pettet]Because I’m a fool. Doh. Thanks - that makes much more sense.

So If I want to add a single byte followed by an Int32, would this work?

[code]Dim start As Byte = &h25
Dim keyLength As UInt32 = mPublicKey.Size

Dim handshake As New Xojo.Core.MutableMemoryBlock(5)
handshake.Int8Value(0) = start
handshake.UInt32Value(1) = keyLength[/code][/quote]
Should.

Thanks Greg. Very helpful.