Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

sbyte equivalent in j#.Net

Hi all,
I have used sbyte in c#. Now I want to know its equivalent datatype in j#.Net. Any help will be highly appreciated.
Regards,
kay cee pee
[166 byte] By [kcpravin] at [2007-11-11 7:32:31]
# 1 Re: sbyte equivalent in j#.Net
byte.
Phil Weber at 2007-11-11 21:48:53 >
# 2 Re: sbyte equivalent in j#.Net
(and btw: C# byte is equivalent to J# ubyte.)
David Anton at 2007-11-11 21:49:59 >
# 3 Re: sbyte equivalent in j#.Net
Hi,

Thanks for your answer. But it didnt help me. The 'Byte' is an unsigned one. The range is (0-255).But my requirement is a Datatype which is a signed one,.The range should be (-127 to 128). Please let me know what can be done.

Pravin
kcpravin at 2007-11-11 21:50:58 >
# 4 Re: sbyte equivalent in j#.Net
Phil gave you the answer - the equivalent to C# sbyte is J# byte.

I was just elaborating by adding the the equivalent to C# byte is J# ubyte.

Sorry for the confusion.
David Anton at 2007-11-11 21:51:56 >
# 5 Re: sbyte equivalent in j#.Net
Hi,

Let me explain the exact problem. I had a code in Java. I used a converter tool to convert the code into C#.Net. Now I want the code to be CLS Compliant. Unfortunately, the converter tool converted Byte of java to SByte of c# which is not CLS compliant. I am clueless as how to go from here. Any help from you guys will be highly appreciated.

Looking for a reply....

Regards,
Pravin
kcpravin at 2007-11-11 21:53:06 >
# 6 Re: sbyte equivalent in j#.Net
Java's byte is equivalent to sbyte (signed byte) in C#. If you need a signed eight-bit number in C#, then sbyte is it. If you must be CLS compliant, your only options are to use a C# byte (unsigned) or a short (signed, but two bytes in size).
Phil Weber at 2007-11-11 21:54:00 >