Csharp/C Sharp/Data Types/short

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

System.UInt16 shorthand (e.g. a ushort)

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


unsigned shorts

 
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());
    }
}