Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / DoubleConverter.cs / 1 / DoubleConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using Microsoft.Win32;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Serialization.Formatters;
using System.Security.Permissions;
///
/// Provides a type
/// converter to convert double-precision, floating point number objects to and from various
/// other representations.
///
[HostProtection(SharedState = true)]
public class DoubleConverter : BaseNumberConverter
{
///
/// Determines whether this editor will attempt to convert hex (0x or #) strings
///
internal override bool AllowHex {
get {
return false;
}
}
///
/// The Type this converter is targeting (e.g. Int16, UInt32, etc.)
///
internal override Type TargetType {
get {
return typeof(Double);
}
}
///
/// Convert the given value to a string using the given radix
///
internal override object FromString(string value, int radix) {
return Convert.ToDouble(value, CultureInfo.CurrentCulture);
}
///
/// Convert the given value to a string using the given formatInfo
///
internal override object FromString(string value, NumberFormatInfo formatInfo) {
return Double.Parse(value, NumberStyles.Float, formatInfo);
}
///
/// Convert the given value to a string using the given CultureInfo
///
internal override object FromString(string value, CultureInfo culture){
return Double.Parse(value, culture);
}
///
/// Convert the given value from a string using the given formatInfo
///
internal override string ToString(object value, NumberFormatInfo formatInfo) {
return ((Double)value).ToString("R", formatInfo);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SchemaSetCompiler.cs
- StylusOverProperty.cs
- SymbolMethod.cs
- Set.cs
- NativeWrapper.cs
- RemoteWebConfigurationHost.cs
- XmlElement.cs
- Color.cs
- SystemIPv6InterfaceProperties.cs
- _Events.cs
- NonValidatingSecurityTokenAuthenticator.cs
- MetadataHelper.cs
- SystemWebSectionGroup.cs
- ControlTemplate.cs
- SqlUserDefinedTypeAttribute.cs
- SocketAddress.cs
- TextTreeDeleteContentUndoUnit.cs
- AssemblyUtil.cs
- UnknownWrapper.cs
- DetailsViewUpdatedEventArgs.cs
- MenuCommand.cs
- BrushValueSerializer.cs
- ComplexPropertyEntry.cs
- LeaseManager.cs
- SqlDataAdapter.cs
- isolationinterop.cs
- Util.cs
- FillErrorEventArgs.cs
- FontUnit.cs
- MouseCaptureWithinProperty.cs
- FontFamily.cs
- CardSpacePolicyElement.cs
- BitmapVisualManager.cs
- SqlFunctions.cs
- WindowPattern.cs
- ColorDialog.cs
- ControlBuilderAttribute.cs
- XsdCachingReader.cs
- PersistNameAttribute.cs
- AudienceUriMode.cs
- LayoutTable.cs
- MsmqIntegrationValidationBehavior.cs
- Internal.cs
- TemplateColumn.cs
- DiscoveryClientRequestChannel.cs
- TranslateTransform.cs
- ScriptDescriptor.cs
- EditorPart.cs
- OrthographicCamera.cs
- GridView.cs
- XmlExceptionHelper.cs
- AsymmetricAlgorithm.cs
- DataPagerFieldCollection.cs
- COM2ComponentEditor.cs
- TemplateComponentConnector.cs
- HttpFileCollection.cs
- SerializationException.cs
- ProcessInfo.cs
- StringFunctions.cs
- MostlySingletonList.cs
- LineGeometry.cs
- OleServicesContext.cs
- AxisAngleRotation3D.cs
- DataRowComparer.cs
- AdCreatedEventArgs.cs
- XmlLoader.cs
- processwaithandle.cs
- HitTestWithPointDrawingContextWalker.cs
- ProcessModuleCollection.cs
- ProfileInfo.cs
- PrintDialog.cs
- _SafeNetHandles.cs
- JpegBitmapEncoder.cs
- TemplatedWizardStep.cs
- XhtmlTextWriter.cs
- TextRangeEditTables.cs
- DataGridViewRowEventArgs.cs
- HandlerFactoryCache.cs
- BinarySecretSecurityToken.cs
- WebResponse.cs
- StorageFunctionMapping.cs
- CollectionType.cs
- BitmapEffectInputConnector.cs
- DoubleCollectionValueSerializer.cs
- DataBoundControl.cs
- WorkflowPrinting.cs
- MemoryMappedViewStream.cs
- ArgumentOutOfRangeException.cs
- KeyboardEventArgs.cs
- Range.cs
- SQLSingle.cs
- hresults.cs
- SslStream.cs
- StringStorage.cs
- XhtmlConformanceSection.cs
- PersonalizationAdministration.cs
- Image.cs
- GeometryHitTestResult.cs
- SecurityToken.cs
- DataSet.cs