Create unsigned shorts by using System.UInt16 in CSharp

Description

The following code shows how to create unsigned shorts by using System.UInt16.

Example


 /*from ww  w  .j ava2  s.com*/
 
 
 

using System;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        System.UInt16 myUInt16 = 30000;
        Console.WriteLine("Max for an UInt16 is: {0} ", UInt16.MaxValue);
        Console.WriteLine("Min for an UInt16 is: {0} ", UInt16.MinValue);
        Console.WriteLine("Value is: {0} ", myUInt16);
        Console.WriteLine("I am a: {0} ", myUInt16.GetType());

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var