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
- BinaryUtilClasses.cs
- HierarchicalDataTemplate.cs
- WebPartConnectionsConnectVerb.cs
- FixUpCollection.cs
- BindingFormattingDialog.cs
- DecimalAnimation.cs
- Enlistment.cs
- HighlightComponent.cs
- AuthenticationConfig.cs
- ActivationServices.cs
- ComponentChangedEvent.cs
- ValidationRuleCollection.cs
- DeclaredTypeElementCollection.cs
- PostBackOptions.cs
- ReferencedType.cs
- CheckBoxStandardAdapter.cs
- ScaleTransform.cs
- BufferBuilder.cs
- CustomCredentialPolicy.cs
- ClipboardData.cs
- DataGridBeginningEditEventArgs.cs
- DataGridViewColumnStateChangedEventArgs.cs
- MonitorWrapper.cs
- OLEDB_Enum.cs
- ConfigXmlAttribute.cs
- StandardBindingElement.cs
- OleDbReferenceCollection.cs
- RelatedCurrencyManager.cs
- PointHitTestParameters.cs
- ApplicationCommands.cs
- TypeBuilderInstantiation.cs
- SamlSecurityToken.cs
- RemoteWebConfigurationHostServer.cs
- TextParaLineResult.cs
- ChannelCacheSettings.cs
- XmlQueryContext.cs
- ProfileService.cs
- Image.cs
- PropertyGeneratedEventArgs.cs
- ByteStreamMessage.cs
- _SSPISessionCache.cs
- GridViewSelectEventArgs.cs
- DrawingCollection.cs
- ColumnClickEvent.cs
- DispatcherProcessingDisabled.cs
- IUnknownConstantAttribute.cs
- AccessText.cs
- IImplicitResourceProvider.cs
- Mouse.cs
- SchemaNamespaceManager.cs
- AspNetHostingPermission.cs
- XmlMtomReader.cs
- TemplateEditingFrame.cs
- WindowsRichEdit.cs
- CursorInteropHelper.cs
- ApplicationTrust.cs
- ListManagerBindingsCollection.cs
- COAUTHIDENTITY.cs
- DebuggerAttributes.cs
- IconConverter.cs
- HttpConfigurationContext.cs
- FamilyMap.cs
- ExtractedStateEntry.cs
- IHttpResponseInternal.cs
- PrintDialog.cs
- Icon.cs
- LostFocusEventManager.cs
- FlowLayout.cs
- ClockController.cs
- DesignerRegion.cs
- DeleteMemberBinder.cs
- SystemThemeKey.cs
- StringUtil.cs
- XmlCDATASection.cs
- JumpItem.cs
- securestring.cs
- CodeChecksumPragma.cs
- Color.cs
- FixedFindEngine.cs
- MTConfigUtil.cs
- TypefaceMap.cs
- Mapping.cs
- KeySpline.cs
- DataGridViewRowPrePaintEventArgs.cs
- UIPermission.cs
- handlecollector.cs
- AlternateView.cs
- XmlSchemaComplexType.cs
- FileChangesMonitor.cs
- UnsafeMethods.cs
- XslException.cs
- GeometryValueSerializer.cs
- ProxyAttribute.cs
- RadioButtonAutomationPeer.cs
- SizeConverter.cs
- BindStream.cs
- ErrorInfoXmlDocument.cs
- TdsValueSetter.cs
- StandardCommandToolStripMenuItem.cs
- SimpleType.cs