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
- SqlMethodAttribute.cs
- X509WindowsSecurityToken.cs
- XmlComplianceUtil.cs
- ExtenderHelpers.cs
- PixelShader.cs
- SqlSupersetValidator.cs
- TypeConstant.cs
- HostSecurityManager.cs
- CollectionConverter.cs
- ConfigXmlCDataSection.cs
- TextTreeExtractElementUndoUnit.cs
- ToolStripOverflow.cs
- Bezier.cs
- TextFormatterHost.cs
- RecognitionResult.cs
- Maps.cs
- ZipIOLocalFileBlock.cs
- DataKeyCollection.cs
- ImageCodecInfo.cs
- SmiSettersStream.cs
- ProxySimple.cs
- ContractDescription.cs
- XpsFilter.cs
- XsdBuilder.cs
- Comparer.cs
- XPathItem.cs
- TracePayload.cs
- StringToken.cs
- VectorAnimation.cs
- TextChangedEventArgs.cs
- AllMembershipCondition.cs
- ContentValidator.cs
- TypeElement.cs
- DataControlImageButton.cs
- ArglessEventHandlerProxy.cs
- WindowsScrollBar.cs
- SapiGrammar.cs
- MailDefinition.cs
- FormViewModeEventArgs.cs
- WorkflowFileItem.cs
- Path.cs
- Guid.cs
- OutOfProcStateClientManager.cs
- UInt64Storage.cs
- DateTimeFormatInfoScanner.cs
- HttpFileCollection.cs
- ChannelFactory.cs
- NativeMethods.cs
- JumpTask.cs
- DataPagerFieldCollection.cs
- LinkArea.cs
- TextTreeUndoUnit.cs
- DBNull.cs
- XmlSerializableReader.cs
- QEncodedStream.cs
- ExecutionEngineException.cs
- XmlArrayAttribute.cs
- ExtensibleSyndicationObject.cs
- UDPClient.cs
- XmlException.cs
- MediaContext.cs
- LinqDataView.cs
- PageContentAsyncResult.cs
- TopClause.cs
- UIElementIsland.cs
- Perspective.cs
- ConstructorExpr.cs
- DesignBindingPropertyDescriptor.cs
- XLinq.cs
- InternalPolicyElement.cs
- PrintingPermission.cs
- DrawToolTipEventArgs.cs
- HintTextConverter.cs
- RotateTransform3D.cs
- MimeTypeMapper.cs
- DefaultValueTypeConverter.cs
- ContractType.cs
- OrderByQueryOptionExpression.cs
- WebScriptEndpoint.cs
- DynamicValidatorEventArgs.cs
- DataGridViewCellParsingEventArgs.cs
- ProviderUtil.cs
- SpellerInterop.cs
- MappingSource.cs
- IsolatedStorageException.cs
- RegistrySecurity.cs
- BindingRestrictions.cs
- Matrix3DStack.cs
- StoreItemCollection.Loader.cs
- Annotation.cs
- basevalidator.cs
- AspCompat.cs
- ExtensionDataReader.cs
- Rect3D.cs
- CharEnumerator.cs
- SecurityUtils.cs
- AuthStoreRoleProvider.cs
- DataGridViewRowConverter.cs
- InputMethod.cs
- FontFamilyConverter.cs