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; ////// [HostProtection(SharedState = true)] public class DoubleConverter : BaseNumberConverter { ///Provides a type /// converter to convert double-precision, floating point number objects to and from various /// other representations. ////// 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; ////// [HostProtection(SharedState = true)] public class DoubleConverter : BaseNumberConverter { ///Provides a type /// converter to convert double-precision, floating point number objects to and from various /// other representations. ////// 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
- GeometryHitTestResult.cs
- ResourceReferenceKeyNotFoundException.cs
- ActivationServices.cs
- StylusEventArgs.cs
- UIElement.cs
- SafeProcessHandle.cs
- AnnotationComponentManager.cs
- PictureBox.cs
- DynamicValueConverter.cs
- XmlSchemaSimpleType.cs
- ToolStripControlHost.cs
- FontFaceLayoutInfo.cs
- SqlClientWrapperSmiStreamChars.cs
- MimeParameters.cs
- SourceFileInfo.cs
- IFlowDocumentViewer.cs
- AggregationMinMaxHelpers.cs
- DispatcherProcessingDisabled.cs
- XhtmlTextWriter.cs
- BitmapCacheBrush.cs
- SmiConnection.cs
- WindowsSecurityTokenAuthenticator.cs
- XmlMembersMapping.cs
- TargetControlTypeAttribute.cs
- RSACryptoServiceProvider.cs
- AmbientProperties.cs
- ImageListUtils.cs
- Item.cs
- HtmlTextBoxAdapter.cs
- ObjectConverter.cs
- SmiMetaDataProperty.cs
- CodeAttributeDeclaration.cs
- ResolveNameEventArgs.cs
- ImmutableCollection.cs
- ToolStripContentPanel.cs
- Model3DGroup.cs
- DocumentPage.cs
- WindowExtensionMethods.cs
- PaintValueEventArgs.cs
- GregorianCalendarHelper.cs
- CssClassPropertyAttribute.cs
- PlaceHolder.cs
- ToggleButton.cs
- HostingEnvironmentException.cs
- ConnectionStringsExpressionBuilder.cs
- FullTextState.cs
- SqlCommand.cs
- TextPointer.cs
- InteropEnvironment.cs
- XmlFileEditor.cs
- StringDictionary.cs
- SoapRpcServiceAttribute.cs
- BrushConverter.cs
- SystemFonts.cs
- PasswordBoxAutomationPeer.cs
- RepeatBehaviorConverter.cs
- FontConverter.cs
- ComponentEditorPage.cs
- StylusSystemGestureEventArgs.cs
- itemelement.cs
- WinFormsComponentEditor.cs
- ISFTagAndGuidCache.cs
- FrameworkPropertyMetadata.cs
- TableRow.cs
- AssemblyNameEqualityComparer.cs
- ImageEditor.cs
- TextFragmentEngine.cs
- DataTemplateSelector.cs
- XmlSchemaInfo.cs
- LinearKeyFrames.cs
- ReplyChannel.cs
- RuleSettings.cs
- BaseConfigurationRecord.cs
- DummyDataSource.cs
- ToolStrip.cs
- URLBuilder.cs
- Part.cs
- TransformProviderWrapper.cs
- SqlXmlStorage.cs
- CapacityStreamGeometryContext.cs
- StylusCollection.cs
- ByeOperationAsyncResult.cs
- RolePrincipal.cs
- IsolatedStorageException.cs
- XsltLibrary.cs
- BrushValueSerializer.cs
- WebExceptionStatus.cs
- ArraySubsetEnumerator.cs
- Monitor.cs
- mongolianshape.cs
- OrderByQueryOptionExpression.cs
- MultiByteCodec.cs
- MethodAccessException.cs
- PrivacyNoticeBindingElement.cs
- XslTransformFileEditor.cs
- SafeEventLogWriteHandle.cs
- ToolStripSystemRenderer.cs
- DynamicMethod.cs
- ApplyImportsAction.cs
- HttpModuleCollection.cs