[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

Is a byte value signed or unsigned?

Is a byte value signed or unsigned?
byte x = 0xF4;
if (x == 244)
if (x == -11) 

Open in new window

will they both work?
0
deleyd
Asked:
deleyd
  • 2
1 Solution
 
andrewjbCommented:
Unsigned.

sbyte is signed.

So 'no' is your answer.
0
 
Paul JacksonCommented:
Byte variables are stored as unsigned 8-bit (1-byte) numbers ranging in value from 0 through 255
0
 
wdosanjosCommented:
byte is an unsigned 8-bit integer, so on the example given only (x == 244) will return true.

byte (C# Reference)
http://msdn.microsoft.com/en-us/library/5bdb6693.aspx

0
 
andrewjbCommented:
You could have probably googled "c# byte" faster than typing in this question :-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now