I have a c++ application. In that application one of the function is returning unsigned char
value. I want to convert that function into C# code. But, I don't have enough knowledge about c++ programming. I want to know what datatype would be placed against c++ unsigned char in C#.
The c++ function is look like this
unsigned char getValue(string s)
{
//SOME CODE HERE
}
The equivalent of unsigned char
in C# is byte
.
byte getValue(string s)
{
}
Second option: if you use unsigned char as a character storage, you should use char
:
char getValue(string s)
{
}
You have to remember, that C++ treats characters and 8-byte values equally. So, for instance in C++:
'A' + 'B' == 65 + 66 == 65 + 'B' == 'A' + 66
You have to check from the context, whether the unsigned char
is a character or a number. From string being passed as a parameter, one can guess, that the function processes characters so mostly probably you want a char
C# type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With