Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / System / ComponentModel / SingleConverter.cs / 1 / SingleConverter.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 SingleConverter : BaseNumberConverter { ///Provides a type /// converter to convert single-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(Single); } } ////// Convert the given value to a string using the given radix /// internal override object FromString(string value, int radix) { return Convert.ToSingle(value, CultureInfo.CurrentCulture); } ////// Convert the given value to a string using the given formatInfo /// internal override object FromString(string value, NumberFormatInfo formatInfo) { return Single.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 Single.Parse(value, culture); } ////// Convert the given value from a string using the given formatInfo /// internal override string ToString(object value, NumberFormatInfo formatInfo) { return ((Single)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 SingleConverter : BaseNumberConverter { ///Provides a type /// converter to convert single-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(Single); } } ////// Convert the given value to a string using the given radix /// internal override object FromString(string value, int radix) { return Convert.ToSingle(value, CultureInfo.CurrentCulture); } ////// Convert the given value to a string using the given formatInfo /// internal override object FromString(string value, NumberFormatInfo formatInfo) { return Single.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 Single.Parse(value, culture); } ////// Convert the given value from a string using the given formatInfo /// internal override string ToString(object value, NumberFormatInfo formatInfo) { return ((Single)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
- BitmapCodecInfo.cs
- CodeDOMProvider.cs
- TypeExtensionConverter.cs
- MetadataArtifactLoaderResource.cs
- HtmlInputText.cs
- WebScriptEnablingElement.cs
- Relationship.cs
- SystemIPv6InterfaceProperties.cs
- SingleKeyFrameCollection.cs
- PerformanceCounterCategory.cs
- DataGridState.cs
- StrokeRenderer.cs
- Page.cs
- ThicknessAnimationUsingKeyFrames.cs
- GlyphRun.cs
- XmlSchemaProviderAttribute.cs
- ImageListUtils.cs
- XPathChildIterator.cs
- WindowsTokenRoleProvider.cs
- PositiveTimeSpanValidatorAttribute.cs
- Assert.cs
- FormsAuthenticationCredentials.cs
- ProgramNode.cs
- CellTreeSimplifier.cs
- PostBackOptions.cs
- CheckBoxAutomationPeer.cs
- DynamicHyperLink.cs
- GridToolTip.cs
- SeekableMessageNavigator.cs
- FunctionMappingTranslator.cs
- VoiceObjectToken.cs
- DnsElement.cs
- TextParagraph.cs
- CertificateElement.cs
- PeerCollaborationPermission.cs
- SapiAttributeParser.cs
- OracleConnectionFactory.cs
- HitTestParameters3D.cs
- SmtpMail.cs
- ListControlConvertEventArgs.cs
- EntityDataSourceWizardForm.cs
- ValueQuery.cs
- MailMessageEventArgs.cs
- ColorConvertedBitmapExtension.cs
- ManipulationPivot.cs
- XmlSecureResolver.cs
- CodeBinaryOperatorExpression.cs
- XmlSchemaAttributeGroup.cs
- IndependentAnimationStorage.cs
- DependencyObjectCodeDomSerializer.cs
- RemoteWebConfigurationHost.cs
- SmiMetaDataProperty.cs
- GridView.cs
- EmptyQuery.cs
- MembershipSection.cs
- CaretElement.cs
- Parsers.cs
- HtmlInputRadioButton.cs
- SHA1Managed.cs
- DataListAutoFormat.cs
- SystemParameters.cs
- SemanticAnalyzer.cs
- ObjectCloneHelper.cs
- ServiceSettingsResponseInfo.cs
- TemplatedAdorner.cs
- Translator.cs
- SendMailErrorEventArgs.cs
- ExtensionQuery.cs
- XmlNode.cs
- DesignObjectWrapper.cs
- DbDeleteCommandTree.cs
- TextRangeEdit.cs
- XslTransform.cs
- WindowsTooltip.cs
- MultiSelector.cs
- XmlSchemaValidator.cs
- PerformanceCounterManager.cs
- ChineseLunisolarCalendar.cs
- RtfToken.cs
- ObjectReferenceStack.cs
- ProxyGenerationError.cs
- AutomationPatternInfo.cs
- InputLanguageProfileNotifySink.cs
- MimeBasePart.cs
- PrintPreviewDialog.cs
- MatrixAnimationBase.cs
- CharAnimationUsingKeyFrames.cs
- Dictionary.cs
- SqlDataSourceStatusEventArgs.cs
- EntityContainer.cs
- NegotiateStream.cs
- AudioFileOut.cs
- DSASignatureDeformatter.cs
- OleDbInfoMessageEvent.cs
- itemelement.cs
- WindowsStartMenu.cs
- DocumentApplicationDocumentViewer.cs
- EncodingDataItem.cs
- StickyNoteAnnotations.cs
- GB18030Encoding.cs