469,282 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Unsigned char

Hello..

Does anyone know the C# equivalent of an unsigned char in C++?

Thanks!

Jun 7 '07 #1
4 48785
On Jun 7, 3:38 pm, hermbag...@gmail.com wrote:
Hello..

Does anyone know the C# equivalent of an unsigned char in C++?

Thanks!
unsigned char? can a char be unsigned? isnt unsigning a contextual
thing?

suppose you have the char - its code is A9, 169 to you and me as an
unsigned byte, or -87 as a signed byte. either way, -87 or 169.. its
still A9, or 10101001 as binary.. or as a char who cares what the
sign is?

Jun 7 '07 #2
In .NET, it is the byte class, as it has the same storage capacity as a
char does in C++.

However, byte is not the inherent character type for .NET. That would
be char. However, you should be aware that a char instance is a 16-bit
value, and not an 8-bit one, like one might expect coming from C++.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<he********@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
Hello..

Does anyone know the C# equivalent of an unsigned char in C++?

Thanks!

Jun 7 '07 #3
he********@gmail.com wrote:
Does anyone know the C# equivalent of an unsigned char in C++?
C++ unsigned char = C# byte
C++ char = C# sbyte

Arne

Jun 8 '07 #4
cjard wrote:
On Jun 7, 3:38 pm, hermbag...@gmail.com wrote:
>Hello..

Does anyone know the C# equivalent of an unsigned char in C++?

unsigned char? can a char be unsigned? isnt unsigning a contextual
thing?
In C++ it can.
suppose you have the char - its code is A9, 169 to you and me as an
unsigned byte, or -87 as a signed byte. either way, -87 or 169.. its
still A9, or 10101001 as binary.. or as a char who cares what the
sign is?
If you do something that does sign extension you will see the difference.

Arne
Jun 8 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by hs | last post: by
4 posts views Thread by ravinderthakur | last post: by
4 posts views Thread by cdrom205 | last post: by
3 posts views Thread by QQ | last post: by
5 posts views Thread by Stephen Cawood | last post: by
5 posts views Thread by ryanlee101 | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.