SingleConverter Class
Assembly: System (in system.dll)
This converter can only convert a single-precision, floating point number object to and from a string. The Single value type represents a single-precision 32-bit number with values ranging from negative 3.402823e38 to positive 3.402823e38.
Note: |
|---|
| You should never create an instance of SingleConverter. Instead, call the GetConverter method of TypeDescriptor. For more information, see the examples in the TypeConverter base class and How to: Implement a Type Converter. |
The following sample converts a variable of type Single to a string, and vice versa.
Dim s As [Single] = 3.402823E+10F Dim mySStr As String = "3.402823E+10" Console.WriteLine(TypeDescriptor.GetConverter(s).ConvertTo(s, GetType(String))) Console.WriteLine(TypeDescriptor.GetConverter(s).ConvertFrom(mySStr))
Single s = (Single)3.402823E+10;
String mySStr = "3.402823E+10";
Console.WriteLine(TypeDescriptor.GetConverter(s).ConvertTo(s,
String.class.ToType()));
Console.WriteLine(TypeDescriptor.GetConverter(s).ConvertFrom(mySStr));
System.ComponentModel.TypeConverter
System.ComponentModel.BaseNumberConverter
System.ComponentModel.SingleConverter
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: