Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

ushort: practical reference

ushort: practical reference: ushort is a 16-bit unsigned integer ranging from 0 through 65535.

Version: C# built-in type reference; .NET 10 runtime

Syntax

ushort value

ushort is a 16-bit unsigned integer ranging from 0 through 65535.

Use it for binary fields and interop with an exact width.

Arithmetic promotes it to int, and mixing with short changes the interpretation of bits.

Overflow wraps or throws in checked context, and not every CLS language supports unsigned APIs.

The complete program actually uses ushort; its exact expected stdout is System.UInt16.

Examples

using System;

Console.WriteLine(typeof(ushort).FullName);

Result

System.UInt16

The complete program actually uses `ushort`; its exact expected stdout is `System.UInt16`.

Sources