what is 0xFF in C#?
What is 0xF开发者_如何学CF in C++? What should I write if I want to convert that to C#?
0xFF is a hexadecimal integer which is 255 in decimal:
FF16 = 25510
In c# you can use it the same way as in c++, c, ruby, php, objective-c, objective-c++, java and many, many other languages:
int x = 0xFF;
if (x == 255) {
// will always happen
} else {
throw unicornNukedProcessingUnitException; // will never happen
}
Hexadecimal numbers are often used to represent octet (byte) values, since you can represent all possible values of an octet with just two hexadecimal digits and surprisingly, the highest value you can represent with two hexadecimal digits is FF, which is 255, which equals the highest value one octet can hold. :)
You write it exactly the same way in C# as you do in C++.
That's the hexidecimal number FF
. Without proper context it's kind of hard to tell you what exactly it's for or what to do to "convert" it to C#.
精彩评论