473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

byte

hi
what is the difference between
byte and Byte.
somehow both seem to work in my program
Nov 16 '05 #1
5 1276
byte is an alias for System.Byte

If you have a "using System;" statement at the top of your file, they are
completely interchangeable, because Byte means System.Byte and byte also
means System.Byte.
If you don't have "using System", then byte will compile but Byte won't (but
System.Byte will and will be equivalent to byte).

The same way, there is no difference between
bool and System.Boolean
int and System.Int32
double and System.Double
string and System.String
etc.

Bruno.

"frazer" <ic***@hotmail.com> a écrit dans le message de
news:e4*************@tk2msftngp13.phx.gbl...
hi
what is the difference between
byte and Byte.
somehow both seem to work in my program

Nov 16 '05 #2
byte is a C# keyword that aliases System.Byte.

Brad Williams
"frazer" <ic***@hotmail.com> wrote in message
news:e4*************@tk2msftngp13.phx.gbl...
hi
what is the difference between
byte and Byte.
somehow both seem to work in my program

Nov 16 '05 #3
thnx for the replies.
but i would like to know when can i use either
Are there any specific situations to use Byte and others to use byte?

thnx

"Brad Williams" <sp**@spam.com> wrote in message
news:c6**********@news01.intel.com...
byte is a C# keyword that aliases System.Byte.

Brad Williams
"frazer" <ic***@hotmail.com> wrote in message
news:e4*************@tk2msftngp13.phx.gbl...
hi
what is the difference between
byte and Byte.
somehow both seem to work in my program


Nov 16 '05 #4
Frazer,

They are completely interchangeable and generate the same IL code.

I believe that most C# coders use the C# keywords -- probably because of the
consistency with C-family syntax (all lower case). It's really a matter of
your personal preference, but I lean towards being consistent with the ethos
of the C# language, and with common usage -- it makes it easier to work with
others.

Whatever you decide to do, it's best in my view to be consistent one way or
the other in your own usage.

--Bob

"Frazer" <Ic***@hotmail.com> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
thnx for the replies.
but i would like to know when can i use either
Are there any specific situations to use Byte and others to use byte?

thnx

"Brad Williams" <sp**@spam.com> wrote in message
news:c6**********@news01.intel.com...
byte is a C# keyword that aliases System.Byte.

Brad Williams
"frazer" <ic***@hotmail.com> wrote in message
news:e4*************@tk2msftngp13.phx.gbl...
hi
what is the difference between
byte and Byte.
somehow both seem to work in my program

Nov 16 '05 #5
Bob Grommes <bo*@bobgrommes.com> wrote:
They are completely interchangeable and generate the same IL code.

I believe that most C# coders use the C# keywords -- probably because of the
consistency with C-family syntax (all lower case). It's really a matter of
your personal preference, but I lean towards being consistent with the ethos
of the C# language, and with common usage -- it makes it easier to work with
others.

Whatever you decide to do, it's best in my view to be consistent one way or
the other in your own usage.


Indeed. The other thing to consider is that for method names, you
should stick to the real type name rather than the C# version, so that
people using your code from other languages won't get confused. So,
you'd have:

GetSingle
instead of
GetFloat

and

GetInt32
instead of
GetInt

Of course, if your code is never going to be called elsewhere, you may
decide to ignore this - but then if you ever *do* write code which is
going to be called from elsewhere, you'll end up being inconsistent
either for other languages or for other existing methods you've
written.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Cook | last post by:
Java's InetAddress class has some methods that use a byte-array to hold what it describes as a 'raw IP address'. So, I assume that they mean an array like: byte ba = new byte; would hold an...
8
by: intrepid_dw | last post by:
Hello, all. I've created a C# dll that contains, among other things, two functions dealing with byte arrays. The first is a function that returns a byte array, and the other is intended to...
6
by: Dennis | last post by:
I was trying to determine the fastest way to build a byte array from components where the size of the individual components varied depending on the user's input. I tried three classes I built: (1)...
8
by: moondaddy | last post by:
I need to convert a byte array to a string and pass it as a parameter in a URL and then convert it back to the original byte array. However, its getting scrambled in the conversion. In short,...
16
by: johannblake | last post by:
I have a variable that is 1 bit wide. I also have a variable that is a byte. I want to shift the bits out of the byte into the bit variable (one at a time) but am not sure how to do this or whether...
4
by: Frederick Gotham | last post by:
What do you think of the following code for setting and retrieving the value of bytes in an unsigned integer? The least significant bit has index 0, then the next least significant bit has index 1,...
1
by: MimiMi | last post by:
I'm trying to decrypt a byte array in java that was encrypted in C#. I don't get any error messages, just a result that's completely not what I was hoping for. I think I am using the same type of...
2
by: MimiMi | last post by:
I'm trying to decrypt a byte array in java that was encrypted in C#. I don't get any error messages, just a result that's completely not what I was hoping for. I think I am using the same type of...
10
by: Scott Townsend | last post by:
So I need to talk to a devices that expects all of the bits and bytes I sent it to be in specific places (not yet 100% defined). I wanted to create a structure/class with all of the data in it...
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.