Leon_Amirreza said:
Ok at least have both byte and sbyte and Int8 and UInt8?
have byte for clarity and UInt8 for uniformity!!!!
The CLR types can only have one name; the CLR folks settled on "Byte". C#
aliases the CLR types with its own type names, so "Byte" is called "byte"
(not that shocking, I know) and "SByte" is called "signed byte". They could
have had UInt8 for the type with C# calling it "byte", but they didn't,
probably for the reasons I outlined earlier.
It's not that hard for *you* to make things uniform by adding another layer.
E.g., if you have code that goes
string intType = (isUnsigned ? "U" : "") + "Int" + sizeInBits;
Just wrap this in a function that goes
string getIntTypeName(bool isUnsigned, int sizeInBits) {
if (sizeInBits == 8) {
return isUnsigned ? "Byte" : "SByte";
} else {
return (isUnsigned ? "U" : "") + "Int" + sizeInBits;
}
}
There. It's an exception, but you only have to write it down once.