2

I can't understand why we can have ushort and uint16… 2 bytes for both. But a problem if I want to use Convert. If I remember well it's ushort.parse(stringtype) while convert.touint16 needs an object.

I searched but can't find why… In the past I used the ushort type, but I begin to think because I need this time to convert object to ushort it's not a good idead to use ushort. I find it's a bit strange to convert to string then to convert to ushort… or to convert to uint16 then to cast to ushort. Perhaps I missed something?

It's not a crucial point but I would like to know.

dferenc
  • 7,918
  • 12
  • 41
  • 49
  • 6
    C#'s `ushort` is just an alias for .Net's `System.UInt16`. You should be able to use `Convert.ToUInt16()` and `ushort.Parse()` without having to do any casting between the two. – Tobias Tengler Dec 01 '18 at 20:35
  • ok, thanks a lot !! –  Dec 02 '18 at 07:55

0 Answers0