DoubleConverter Class
Provides a type converter to convert double-precision, floating point number objects to and from various other representations.
For a list of all members of this type, see DoubleConverter Members.
System.Object
System.ComponentModel.TypeConverter
System.ComponentModel.BaseNumberConverter
System.ComponentModel.DoubleConverter
[Visual Basic] Public Class DoubleConverter Inherits BaseNumberConverter [C#] public class DoubleConverter : BaseNumberConverter [C++] public __gc class DoubleConverter : public BaseNumberConverter [JScript] public class DoubleConverter 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 Double object to and from a string.
Note You should never create an instance of DoubleConverter. Instead, call the GetConverter method of TypeDescriptor. For more information, see the examples in the TypeConverter base class.
For more information about type converters, see the TypeConverter base class and Implementing a Type Converter.
Example
[Visual Basic, C#, C++] The following sample converts a variable of type Double to a string, and vice versa.
[Visual Basic] Dim myDoub As Double = 100.55 Dim myDoStr As String = "4000.425" Console.WriteLine(TypeDescriptor.GetConverter(myDoub).ConvertTo(myDoub, GetType(String))) Console.WriteLine(TypeDescriptor.GetConverter(myDoub).ConvertFrom(myDoStr)) [C#] double myDoub = 100.55; string myDoStr = "4000.425"; Console.WriteLine(TypeDescriptor.GetConverter(myDoub).ConvertTo(myDoub, typeof(string))); Console.WriteLine(TypeDescriptor.GetConverter(myDoub).ConvertFrom(myDoStr)); [C++] double myDoub( 100.55 ); String* myDoStr = S"4000.425"; Console::WriteLine(TypeDescriptor::GetConverter(__box(myDoub))->ConvertTo(__box(myDoub), __typeof(String))); Console::WriteLine(TypeDescriptor::GetConverter(__box(myDoub))->ConvertFrom(myDoStr));
[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)