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
- glyphs.cs
- InputProcessorProfilesLoader.cs
- ListControl.cs
- XmlNamespaceDeclarationsAttribute.cs
- shaperfactoryquerycachekey.cs
- CorrelationManager.cs
- MissingFieldException.cs
- SqlGatherProducedAliases.cs
- XmlDigitalSignatureProcessor.cs
- BuildResult.cs
- DependencyObjectProvider.cs
- ValidationResult.cs
- ToolStripStatusLabel.cs
- ToolboxItem.cs
- ProxyHwnd.cs
- Stream.cs
- BaseTemplateCodeDomTreeGenerator.cs
- SqlFacetAttribute.cs
- DataColumnMappingCollection.cs
- PersistenceTypeAttribute.cs
- CompletionCallbackWrapper.cs
- MarkupObject.cs
- StringWriter.cs
- DateTimeFormat.cs
- ReceiveActivityValidator.cs
- DataGridViewIntLinkedList.cs
- TypePropertyEditor.cs
- SiteIdentityPermission.cs
- CopyEncoder.cs
- TickBar.cs
- DecoderFallback.cs
- DataGridViewCellLinkedList.cs
- ProgressChangedEventArgs.cs
- StorageEntitySetMapping.cs
- EntityDataSourceColumn.cs
- MarkupCompiler.cs
- ResourcesBuildProvider.cs
- ResourcesChangeInfo.cs
- PackageRelationshipCollection.cs
- AudioStateChangedEventArgs.cs
- AlphabeticalEnumConverter.cs
- QilUnary.cs
- DataObject.cs
- NumberFunctions.cs
- TypeUtil.cs
- DataGridViewCellValidatingEventArgs.cs
- ImpersonateTokenRef.cs
- UnsafeNativeMethods.cs
- MenuItem.cs
- MimeParameterWriter.cs
- BitmapCache.cs
- _CommandStream.cs
- Accessible.cs
- SqlDeflator.cs
- SafeHandles.cs
- InputMethodStateChangeEventArgs.cs
- BinaryWriter.cs
- ApplyHostConfigurationBehavior.cs
- UriSectionReader.cs
- StringUtil.cs
- CompiledAction.cs
- DayRenderEvent.cs
- WebPartTransformerAttribute.cs
- Int64Converter.cs
- DataGridColumnCollection.cs
- RtfToXamlLexer.cs
- CompilationUtil.cs
- CodeBinaryOperatorExpression.cs
- CharEnumerator.cs
- XmlSchemaComplexType.cs
- CorrelationManager.cs
- CharEntityEncoderFallback.cs
- TreeNode.cs
- TypeUtils.cs
- FilterableData.cs
- CodeDOMProvider.cs
- StoreItemCollection.Loader.cs
- FormsIdentity.cs
- StatusBarPanelClickEvent.cs
- ContentHostHelper.cs
- ProfilePropertySettings.cs
- ErrorInfoXmlDocument.cs
- LineGeometry.cs
- ReferencedCategoriesDocument.cs
- OutputCacheSettings.cs
- HttpProcessUtility.cs
- StandardTransformFactory.cs
- SqlOuterApplyReducer.cs
- X509Certificate2Collection.cs
- ControlCachePolicy.cs
- TableFieldsEditor.cs
- SHA256.cs
- DecoderExceptionFallback.cs
- HtmlTable.cs
- ExtensionElement.cs
- CheckableControlBaseAdapter.cs
- ConfigXmlWhitespace.cs
- LightweightEntityWrapper.cs
- TextEditorCharacters.cs
- FileFormatException.cs