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
- GenericsInstances.cs
- WindowsMenu.cs
- SchemaTypeEmitter.cs
- ElementsClipboardData.cs
- XmlRawWriter.cs
- StateManagedCollection.cs
- HttpRuntimeSection.cs
- AttachmentCollection.cs
- CodeRemoveEventStatement.cs
- ContextBase.cs
- NativeObjectSecurity.cs
- CheckBoxBaseAdapter.cs
- HttpException.cs
- cookiecontainer.cs
- ViewBase.cs
- StrokeNodeOperations2.cs
- BookmarkScope.cs
- COM2ExtendedUITypeEditor.cs
- DbParameterCollection.cs
- EntityContainerEmitter.cs
- DefaultClaimSet.cs
- PrePostDescendentsWalker.cs
- SynchronizedDispatch.cs
- ToolStripOverflow.cs
- LocalServiceSecuritySettings.cs
- DeviceContext2.cs
- NotFiniteNumberException.cs
- PointAnimationBase.cs
- TokenBasedSet.cs
- TypeSystem.cs
- CompilationUtil.cs
- AutomationTextAttribute.cs
- EdmSchemaAttribute.cs
- QueryStack.cs
- PriorityQueue.cs
- CryptoHelper.cs
- ValidationRuleCollection.cs
- SmiTypedGetterSetter.cs
- _NetRes.cs
- AppearanceEditorPart.cs
- CodeParameterDeclarationExpression.cs
- ActivityInstance.cs
- ExpressionBindings.cs
- MasterPageBuildProvider.cs
- EntityCommandExecutionException.cs
- SmtpClient.cs
- VarRemapper.cs
- DataGridColumn.cs
- GridLengthConverter.cs
- ManagedIStream.cs
- HtmlElement.cs
- Convert.cs
- LogConverter.cs
- Vector3DConverter.cs
- LayoutSettings.cs
- EventLog.cs
- PointAnimationBase.cs
- FormatConvertedBitmap.cs
- D3DImage.cs
- NonParentingControl.cs
- XmlnsCompatibleWithAttribute.cs
- Crypto.cs
- HttpVersion.cs
- ListViewAutomationPeer.cs
- ObjectDisposedException.cs
- PerfCounterSection.cs
- NotEqual.cs
- SchemaAttDef.cs
- XAMLParseException.cs
- Viewport3DAutomationPeer.cs
- WmlFormAdapter.cs
- ImageKeyConverter.cs
- X509RawDataKeyIdentifierClause.cs
- XamlPointCollectionSerializer.cs
- SiteMapProvider.cs
- HtmlTitle.cs
- TraceHandler.cs
- WorkflowItemsPresenter.cs
- CombinedGeometry.cs
- MouseButtonEventArgs.cs
- SafeNativeHandle.cs
- SingleTagSectionHandler.cs
- EventRoute.cs
- Utility.cs
- DayRenderEvent.cs
- RegisteredScript.cs
- columnmapkeybuilder.cs
- DataStreamFromComStream.cs
- SymmetricCryptoHandle.cs
- ConfigurationStrings.cs
- XmlCompatibilityReader.cs
- ChangeConflicts.cs
- DocumentSchemaValidator.cs
- MappingItemCollection.cs
- RelationalExpressions.cs
- OpenTypeCommon.cs
- FlowDocument.cs
- followingsibling.cs
- CounterSample.cs
- RubberbandSelector.cs