Compartir a través de


Conversion Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

The Conversion module contains the procedures used to perform various conversion operations.

Inheritance Hierarchy

System.Object
  Microsoft.VisualBasic.Conversion

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
<StandardModuleAttribute> _
Public NotInheritable Class Conversion
[StandardModuleAttribute]
public sealed class Conversion

The Conversion type exposes the following members.

Methods

  Name Description
Public methodStatic member CTypeDynamic(Object, Type) Converts an object to the specified type.
Public methodStatic member CTypeDynamic<TargetType>(Object) Converts an object to the specified generic type.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodStatic member ErrorToString() Returns the error message that corresponds to a given error number.
Public methodStatic member ErrorToString(Int32) Returns the error message that corresponds to a given error number.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic member Fix(Decimal) Return the integer portion of a number.
Public methodStatic member Fix(Double) Return the integer portion of a number.
Public methodStatic member Fix(Int16) Return the integer portion of a number.
Public methodStatic member Fix(Int32) Return the integer portion of a number.
Public methodStatic member Fix(Int64) Return the integer portion of a number.
Public methodStatic member Fix(Object) Return the integer portion of a number.
Public methodStatic member Fix(Single) Return the integer portion of a number.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public methodStatic member Hex(Byte) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(Int16) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(Int32) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(Int64) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(Object) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(SByte) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(UInt16) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(UInt32) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Hex(UInt64) Returns a string representing the hexadecimal value of a number.
Public methodStatic member Int(Decimal) Return the integer portion of a number.
Public methodStatic member Int(Double) Return the integer portion of a number.
Public methodStatic member Int(Int16) Return the integer portion of a number.
Public methodStatic member Int(Int32) Return the integer portion of a number.
Public methodStatic member Int(Int64) Return the integer portion of a number.
Public methodStatic member Int(Object) Return the integer portion of a number.
Public methodStatic member Int(Single) Return the integer portion of a number.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic member Str Returns a String representation of a number.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public methodStatic member Val(Char) Returns the numbers contained in a string as a numeric value of appropriate type.
Public methodStatic member Val(Object) Returns the numbers contained in a string as a numeric value of appropriate type.
Public methodStatic member Val(String) Returns the numbers contained in a string as a numeric value of appropriate type.

Top

Remarks

This module supports the Visual Basic language keywords and run-time library members that convert decimal numbers to other bases, numbers to strings, strings to numbers, and one data type to another.

Examples

This example uses the Hex function to return the hexadecimal value of a number.

Dim TestHex As String
' Returns 5.
TestHex = Hex(5)
' Returns A.
TestHex = Hex(10)
' Returns 1CB.
TestHex = Hex(459)

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference