Int64Converter Class
Provides a type converter to convert 64-bit signed integer objects to and from various other representations.
For a list of all members of this type, see Int64Converter Members.
System.Object
System.ComponentModel.TypeConverter
System.ComponentModel.BaseNumberConverter
System.ComponentModel.Int64Converter
[Visual Basic] Public Class Int64Converter Inherits BaseNumberConverter [C#] public class Int64Converter : BaseNumberConverter [C++] public __gc class Int64Converter : public BaseNumberConverter [JScript] public class Int64Converter extends BaseNumberConverter
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.
Remarks
This converter can only convert a 64-bit signed integer object to and from a string. The Int64 value type represents integers with values ranging from negative 9,223,372,036,854,775,808 through positive 9,223,372,036,854,775,807.
The ConvertFrom method uses the Parse method of Int64 with the integer value of NumberStyles.
The ConvertTo method uses the general ("G") format for the string returned.
For more information about type converters, see the TypeConverter base class and Implementing a Type Converter.
Note You should never create an instance of an Int64Converter. Instead, call the GetConverter method of TypeDescriptor. For more information, see the examples in the TypeConverter base class.
Example
[Visual Basic, C#, C++] The following sample converts a variable of type Int64 to a string, and vice versa.
[Visual Basic] Dim myInt64 As Long = -123456789123 Dim myInt64String As String = "+184467440737095551" Console.WriteLine(TypeDescriptor.GetConverter(myInt64).ConvertTo(myInt64, GetType(String))) Console.WriteLine(TypeDescriptor.GetConverter(myInt64).ConvertFrom(myInt64String)) [C#] long myInt64 = -123456789123; string myInt64String = "+184467440737095551"; Console.WriteLine(TypeDescriptor.GetConverter(myInt64).ConvertTo(myInt64, typeof(string))); Console.WriteLine(TypeDescriptor.GetConverter(myInt64).ConvertFrom(myInt64String)); [C++] long myInt64( -123456789123 ); String* myInt64String = S"+184467440737095551"; Console::WriteLine(TypeDescriptor::GetConverter(__box(myInt64))->ConvertTo(__box(myInt64), __typeof(String))); Console::WriteLine(TypeDescriptor::GetConverter(__box(myInt64))->ConvertFrom(myInt64String));
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.ComponentModel
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)
See Also
Int64Converter Members | System.ComponentModel Namespace | TypeConverter