Code:
/ FX-1434 / FX-1434 / 1.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
- Constant.cs
- SafeLocalMemHandle.cs
- EdmPropertyAttribute.cs
- ToolStripDropDownDesigner.cs
- PageSetupDialog.cs
- Int16AnimationUsingKeyFrames.cs
- SignatureResourcePool.cs
- StylusButtonCollection.cs
- MsmqIntegrationSecurity.cs
- CodeAssignStatement.cs
- AttributeUsageAttribute.cs
- FormViewUpdatedEventArgs.cs
- Version.cs
- ProfileServiceManager.cs
- VisualBrush.cs
- WebPartConnectionsEventArgs.cs
- XamlPoint3DCollectionSerializer.cs
- CollectionBuilder.cs
- XsdBuildProvider.cs
- ChannelManager.cs
- HierarchicalDataBoundControl.cs
- DetailsViewPageEventArgs.cs
- ResolveRequestResponseAsyncResult.cs
- SafeViewOfFileHandle.cs
- WinFormsUtils.cs
- FrameworkContentElement.cs
- Graphics.cs
- Collection.cs
- Viewport3DAutomationPeer.cs
- SqlMethodTransformer.cs
- LinearGradientBrush.cs
- FlowchartDesigner.xaml.cs
- ColumnHeader.cs
- MouseGestureValueSerializer.cs
- DirectoryInfo.cs
- InstanceStore.cs
- ParserStreamGeometryContext.cs
- ValueTable.cs
- IndexExpression.cs
- printdlgexmarshaler.cs
- DataListItemEventArgs.cs
- DocumentGridContextMenu.cs
- DeploymentSectionCache.cs
- CharAnimationUsingKeyFrames.cs
- AnnotationComponentManager.cs
- Errors.cs
- XmlSignificantWhitespace.cs
- SafeNativeMethods.cs
- MultipartContentParser.cs
- PowerModeChangedEventArgs.cs
- WebHttpDispatchOperationSelectorData.cs
- TableItemStyle.cs
- MatchAttribute.cs
- DataRecordInternal.cs
- PageSettings.cs
- EnglishPluralizationService.cs
- DocumentPageViewAutomationPeer.cs
- WebPart.cs
- AsymmetricSignatureDeformatter.cs
- ProjectionCamera.cs
- AtomServiceDocumentSerializer.cs
- TreeNodeCollection.cs
- InheritanceContextChangedEventManager.cs
- SoundPlayerAction.cs
- RegionIterator.cs
- AnimatedTypeHelpers.cs
- ResolveMatchesCD1.cs
- SmtpReplyReaderFactory.cs
- ArrayItemReference.cs
- ContractMapping.cs
- FormsAuthenticationEventArgs.cs
- CallSite.cs
- ProjectionCamera.cs
- Variable.cs
- CultureInfoConverter.cs
- VectorAnimationBase.cs
- ImageBrush.cs
- SafeArchiveContext.cs
- BadImageFormatException.cs
- PropertyValue.cs
- ContextStaticAttribute.cs
- CharEnumerator.cs
- Overlapped.cs
- ToolStripDropDownItem.cs
- RawStylusActions.cs
- XappLauncher.cs
- ObjectQuery.cs
- UnsafeNativeMethods.cs
- SQLSingleStorage.cs
- FilteredDataSetHelper.cs
- GB18030Encoding.cs
- HostedHttpTransportManager.cs
- ToolStripControlHost.cs
- KeyEvent.cs
- XmlReflectionImporter.cs
- TransportManager.cs
- WebHttpBinding.cs
- InputLangChangeRequestEvent.cs
- Context.cs
- ListView.cs