Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// 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);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AuthorizationSection.cs
- UnsafeNativeMethods.cs
- CoordinationService.cs
- PermissionAttributes.cs
- GridItemProviderWrapper.cs
- ButtonBaseAutomationPeer.cs
- CryptoApi.cs
- StackBuilderSink.cs
- BamlTreeUpdater.cs
- StatusBarPanelClickEvent.cs
- TypefaceMetricsCache.cs
- XmlAttributeOverrides.cs
- FreezableOperations.cs
- DataControlLinkButton.cs
- TextViewSelectionProcessor.cs
- Visual.cs
- MSAAWinEventWrap.cs
- HttpConfigurationSystem.cs
- DataTemplateKey.cs
- WebServiceErrorEvent.cs
- GatewayIPAddressInformationCollection.cs
- InfoCardKeyedHashAlgorithm.cs
- Baml2006KeyRecord.cs
- ApplicationDirectoryMembershipCondition.cs
- TextChange.cs
- PerfProviderCollection.cs
- BinaryNode.cs
- Geometry.cs
- AliasedSlot.cs
- XmlSchemaFacet.cs
- TransformProviderWrapper.cs
- EntityDataSourceValidationException.cs
- Dump.cs
- ParentUndoUnit.cs
- HtmlTernaryTree.cs
- __TransparentProxy.cs
- OrderToken.cs
- TimeSpanStorage.cs
- OuterGlowBitmapEffect.cs
- ScriptControl.cs
- AppLevelCompilationSectionCache.cs
- ControlHelper.cs
- BackgroundWorker.cs
- MatrixConverter.cs
- MultiSelector.cs
- Model3DGroup.cs
- UnknownBitmapEncoder.cs
- TableLayoutColumnStyleCollection.cs
- CollectionsUtil.cs
- TypeDependencyAttribute.cs
- CacheVirtualItemsEvent.cs
- GridViewColumnCollection.cs
- IpcManager.cs
- QilParameter.cs
- DuplicateDetector.cs
- WCFModelStrings.Designer.cs
- ValueChangedEventManager.cs
- SchemaElement.cs
- CryptoProvider.cs
- PersianCalendar.cs
- CodeTypeDeclaration.cs
- RelationshipEndCollection.cs
- RemotingSurrogateSelector.cs
- PageAdapter.cs
- StringValidator.cs
- DuplicateContext.cs
- TreeNodeCollection.cs
- LinqToSqlWrapper.cs
- DeflateEmulationStream.cs
- DependencyObjectProvider.cs
- CustomErrorsSection.cs
- DateTimeConstantAttribute.cs
- XmlDataImplementation.cs
- SqlServer2KCompatibilityAnnotation.cs
- DocumentStream.cs
- AssemblyAssociatedContentFileAttribute.cs
- Binding.cs
- DocumentationServerProtocol.cs
- Timer.cs
- ResetableIterator.cs
- MultiSelectRootGridEntry.cs
- StorageRoot.cs
- DataServiceQueryProvider.cs
- HostProtectionException.cs
- TailCallAnalyzer.cs
- Parser.cs
- CodeAttributeDeclarationCollection.cs
- MouseActionValueSerializer.cs
- translator.cs
- QuaternionKeyFrameCollection.cs
- UserNamePasswordServiceCredential.cs
- EncoderFallback.cs
- ToggleButton.cs
- SettingsContext.cs
- WindowsAuthenticationEventArgs.cs
- CommandPlan.cs
- DataGridRow.cs
- WebEvents.cs
- StateManagedCollection.cs
- GeneralTransform3DGroup.cs