Convert.ToUInt16 (UInt64) converts 64-bit unsigned integer to 16-bit unsigned integer. : Convert to UInt16 « Development « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net » Development » Convert to UInt16Screenshots 
Convert.ToUInt16 (UInt64) converts 64-bit unsigned integer to 16-bit unsigned integer.
  

        
Class Sample
   Public Shared Sub Main()
        Dim numbers() As ULong = UInt64.MinValue, 121340, UInt64.MaxValue }
        Dim result As UShort
        For Each number As ULong In numbers
           Try
              result = Convert.ToUInt16(number)
              Console.WriteLine(result)
           Catch As OverflowException
              Console.WriteLine("The {0} value {1} is outside the range of the UInt16 type.", _
                                number.GetType().Name, number)
           End Try
        Next
    End Sub 
End Class

   
    
  
Related examples in the same category
1.Convert.ToUInt16 (Boolean) converts Boolean to 16-bit unsigned integer.
2.Convert.ToUInt16 (Byte) converts 8-bit unsigned integer to 16-bit unsigned integer.
3.Convert.ToUInt16 (Char) converts Unicode character to 16-bit unsigned integer.
4.Convert.ToUInt16 (Decimal) converts decimal number to 16-bit unsigned integer.
5.Convert.ToUInt16 (Double) converts double-precision floating-point number to 16-bit unsigned integer.
6.Convert.ToUInt16 (Int16) converts 16-bit signed integer to 16-bit unsigned integer.
7.Convert.ToUInt16 (Int32) converts 32-bit signed integer to 16-bit unsigned integer.
8.Convert.ToUInt16 (Int64) converts 64-bit signed integer to 16-bit unsigned integer.
9.Convert.ToUInt16 (Object) converts object to a 16-bit unsigned integer.
10.Convert.ToUInt16 (SByte) converts 8-bit signed integer to 16-bit unsigned integer.
11.Convert.ToUInt16 (Single) converts single-precision floating-point number to 16-bit unsigned integer.
12.Convert.ToUInt16 (String) converts string to 16-bit unsigned integer.
13.Convert.ToUInt16 (String, IFormatProvider) converts string to 16-bit unsigned integer in culture settings
14.Convert.ToUInt16 (String, Int32) converts string in a base to 16-bit unsigned integer.
15.Use Convert.ToUInt16 to convert hex String to UInt16
16.Convert.ToUInt16 (UInt32) converts 32-bit unsigned integer to 16-bit unsigned integer.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.