[Mono-winforms-list] Endians

Pavel Bansky levap at bansky.net
Mon Jul 17 03:06:26 EDT 2006


Thanks for your fast reply Kornel.
I'am interested especialy in BitConverter.GetBytes()
I wrote me following little function which should return always 
little-endian array. Is this right or BitConverter always return 
little-endian array?

byte[] GetBytesLittleEndian(int number)
{
	byte[] bytearray = BitConverter.GetBytes(number);

	if ( ! BitConverter.IsLittleEndian ) Array.Reverse(bytearray);

	return(bytearray);
}


have a nice day

  Pavel


Kornél Pál wrote:

> Hi,
> 
> Have a look at this message and the messages referred to in it:
> http://lists.ximian.com/pipermail/mono-devel-list/2005-December/016352.html
> 
> Kornél
> 
> ----- Original Message ----- From: "Pavel Bansky" <levap at bansky.net>
> To: "winforms" <mono-winforms-list at lists.ximian.com>
> Sent: Sunday, July 16, 2006 6:48 PM
> Subject: [Mono-winforms-list] Endians
> 
> 
> Hi all,
> 
> I have a little question (maybe a bit off-topic). Does MS.NET and Mono
> use the same endians on every machines? I mean when I write integer into
> binary file, will be the byte order same on all architectures - or the
> framework respects endians for current architecture?
> 
>  Thanx a lot
> 
>  Pavel
> 

-- 
__________________________________________________________

Pavel Bánský
levap at bansky.net                        I write code...
__________________________________________________________


More information about the Mono-winforms-list mailing list