Solved

Is a byte value signed or unsigned?

Posted on 2011-09-12
4
434 Views
Last Modified: 2012-05-12
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
Comment
Question by:deleyd
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
andrewjb earned 125 total points
ID: 36523588
Unsigned.

sbyte is signed.

So 'no' is your answer.
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 36523598
Byte variables are stored as unsigned 8-bit (1-byte) numbers ranging in value from 0 through 255
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 36523605
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
 
LVL 12

Expert Comment

by:andrewjb
ID: 36523612
You could have probably googled "c# byte" faster than typing in this question :-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS subreport with parameter 3 47
Create a WebAPI using a generic return parameter 9 31
C# MVC Insert Multiple Row into DB 2 32
linq, c# 8 24
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question