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
- AncillaryOps.cs
- ObjectListCommand.cs
- UnsafeNativeMethods.cs
- WebEventTraceProvider.cs
- ChtmlSelectionListAdapter.cs
- SortKey.cs
- AnnotationResourceCollection.cs
- TraceInternal.cs
- PropertyGeneratedEventArgs.cs
- PersonalizationState.cs
- ContainerVisual.cs
- StyleXamlParser.cs
- EditorBrowsableAttribute.cs
- UnauthorizedWebPart.cs
- WhitespaceRuleLookup.cs
- SspiNegotiationTokenAuthenticatorState.cs
- CodeGenerator.cs
- QuaternionRotation3D.cs
- SqlWriter.cs
- CommittableTransaction.cs
- ErrorHandler.cs
- RelationshipWrapper.cs
- WriterOutput.cs
- XmlAnyElementAttributes.cs
- XamlStream.cs
- InlinedAggregationOperatorEnumerator.cs
- InstanceLockedException.cs
- LongTypeConverter.cs
- CodeBlockBuilder.cs
- ServiceDiscoveryBehavior.cs
- StrokeFIndices.cs
- SmtpAuthenticationManager.cs
- EventManager.cs
- BitmapFrameDecode.cs
- BindingNavigator.cs
- Odbc32.cs
- AuthenticatingEventArgs.cs
- ClientCultureInfo.cs
- UriTemplatePathSegment.cs
- PenLineCapValidation.cs
- CapabilitiesAssignment.cs
- HttpResponse.cs
- DynamicILGenerator.cs
- IItemProperties.cs
- SqlMethods.cs
- Sql8ConformanceChecker.cs
- HtmlGenericControl.cs
- HttpProtocolImporter.cs
- AdCreatedEventArgs.cs
- SendActivityEventArgs.cs
- CommandValueSerializer.cs
- MultitargetingHelpers.cs
- CustomValidator.cs
- StrokeCollection2.cs
- WindowsSlider.cs
- ReferencedType.cs
- DataGridViewToolTip.cs
- DataTableNewRowEvent.cs
- MenuItemBindingCollection.cs
- MsmqEncryptionAlgorithm.cs
- PagesChangedEventArgs.cs
- PatternMatcher.cs
- PropertyGeneratedEventArgs.cs
- RequestQueryParser.cs
- OleDbReferenceCollection.cs
- DecoderBestFitFallback.cs
- GraphicsState.cs
- MemberMemberBinding.cs
- NumberSubstitution.cs
- TerminateDesigner.cs
- DataPagerFieldCollection.cs
- PartialCachingAttribute.cs
- TextEndOfParagraph.cs
- ConfigurationLocation.cs
- RelatedPropertyManager.cs
- ToggleProviderWrapper.cs
- MLangCodePageEncoding.cs
- StaticTextPointer.cs
- DataGridViewComboBoxEditingControl.cs
- Pair.cs
- HistoryEventArgs.cs
- PriorityBinding.cs
- TaskFileService.cs
- GeneralTransform3DTo2D.cs
- NamedPipeTransportSecurityElement.cs
- ClientUtils.cs
- EdmProperty.cs
- SpeechSeg.cs
- StrongName.cs
- GradientStop.cs
- X509Certificate2Collection.cs
- TablePattern.cs
- VisualStyleInformation.cs
- XmlDomTextWriter.cs
- MeshGeometry3D.cs
- SymbolType.cs
- VectorCollectionConverter.cs
- KeyFrames.cs
- PolicyException.cs
- EditCommandColumn.cs