Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2008, 01:37 AM
Authorized User
 
Join Date: Aug 2007
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yukijocelyn
Default C# data types format

Hi

I would like to ask if C#'s data in Big-Endian or in Small-Endian?
If any of you know Java's data is in Big or Small Endian?

Coz I'm doing a client server program, but my client have to be in C#, while my server in Java. I have problems converting C#'s byte array to Java's integer.

Does anyone have suggestions to this?

Thanks!

 
Old August 19th, 2008, 04:01 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You will become a much better developer if you learn to use the tools at your disposal.

Google provided me with the following answer:

http://msdn.microsoft.com/en-us/libr...tleendian.aspx

/- Sam Judson : Wrox Technical Editor -/
 
Old August 19th, 2008, 11:38 AM
Authorized User
 
Join Date: Aug 2007
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yukijocelyn
Default

Hi!

Thanks for replying. Err, my programming isn't very good.
But wanna ask... From what you gave me, you mean I can set my C# program to be either of Little-Endian or Big-Endian?

Thank you for helping!
 
Old August 19th, 2008, 03:30 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Has *NOTHING* to do with the LANGUAGE you are using.

Big-endian/little-endian is completely a HARDWARE question. The CPU determines which "endian" is used. The language, per se, does not care. Yes, there are a (very few) library functions that need to no which "endian" the HARDWARE is using, but the actual language in use shouldn't know or care.

Now, since C# is a Microsoft language, and since all the MS languages were originally developed for the Intel-type processors, indeed you would expect that the standard libraries used by C# (and, indeed, by all the .NET languages) would be little-endian. But there is no reason that you couldn't create a CLR (Common Language Runtime...the "core" of all .NET languages) and matching library for big-endian machines. Personally, I very much doubt that Microsoft has chosen to do so at this time, but there's no theoretical reason it couldn't be done. But, again, this has NOTHING directly to do with the language, per se.
 
Old August 19th, 2008, 03:37 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You may be having a problem with "network byte order"???

Networks usually use big-endian order. But, really, if you are using a standard communications package that should be taken care of for you.

What kind of hardware is the Java-based code running on?





Similar Threads
Thread Thread Starter Forum Replies Last Post
System Data Types liamfitz Beginning VB 6 0 October 17th, 2006 05:31 PM
Data Types Clive Astley Access 1 January 17th, 2006 04:13 PM
Data Types edward2006 Infopath 0 November 7th, 2005 06:06 PM
Data Types bph Access VBA 3 January 25th, 2004 05:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.