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
- NativeMethods.cs
- VisualStateGroup.cs
- GeometryCombineModeValidation.cs
- PersonalizationState.cs
- MultiTrigger.cs
- ServicePointManager.cs
- SessionIDManager.cs
- ParameterCollectionEditorForm.cs
- SliderAutomationPeer.cs
- ToolboxItemCollection.cs
- PathBox.cs
- WebPartCancelEventArgs.cs
- SizeF.cs
- QilXmlWriter.cs
- XomlSerializationHelpers.cs
- _TransmitFileOverlappedAsyncResult.cs
- Deserializer.cs
- DecoderFallbackWithFailureFlag.cs
- HtmlHead.cs
- ImageFormat.cs
- LogWriteRestartAreaState.cs
- ObservableCollection.cs
- TypeConverterAttribute.cs
- ValidationErrorEventArgs.cs
- ScriptServiceAttribute.cs
- IndexedSelectQueryOperator.cs
- AttachedAnnotationChangedEventArgs.cs
- Privilege.cs
- Win32.cs
- SQLSingleStorage.cs
- WindowsPen.cs
- GridView.cs
- SymDocumentType.cs
- ConfigurationManager.cs
- AlternateView.cs
- XPathMultyIterator.cs
- SqlDataSourceSelectingEventArgs.cs
- SetStoryboardSpeedRatio.cs
- SchemaNames.cs
- EntityDataSourceWizardForm.cs
- HotSpotCollection.cs
- PriorityChain.cs
- BulletedList.cs
- FragmentQuery.cs
- AccessViolationException.cs
- HttpResponseMessageProperty.cs
- TargetControlTypeCache.cs
- PeerInputChannelListener.cs
- DocumentViewerHelper.cs
- WebServiceHandler.cs
- CodeDOMUtility.cs
- StringValueSerializer.cs
- GAC.cs
- GlobalProxySelection.cs
- AddInDeploymentState.cs
- WrappingXamlSchemaContext.cs
- KeyFrames.cs
- ReflectEventDescriptor.cs
- xsdvalidator.cs
- RequestCache.cs
- ListBoxChrome.cs
- TraceSection.cs
- XmlElementElement.cs
- SystemGatewayIPAddressInformation.cs
- BatchParser.cs
- Drawing.cs
- HtmlInputFile.cs
- TripleDESCryptoServiceProvider.cs
- CapabilitiesRule.cs
- SpellerHighlightLayer.cs
- KeyFrames.cs
- UnsafeNativeMethods.cs
- OdbcDataReader.cs
- DataBinder.cs
- MemberRelationshipService.cs
- LightweightCodeGenerator.cs
- ItemsControlAutomationPeer.cs
- HybridDictionary.cs
- Int32CollectionConverter.cs
- ToolStripGripRenderEventArgs.cs
- HtmlInputSubmit.cs
- UshortList2.cs
- MaterializeFromAtom.cs
- AdditionalEntityFunctions.cs
- FlatButtonAppearance.cs
- MetaType.cs
- XmlTextWriter.cs
- SafeCryptoHandles.cs
- PropertyGeneratedEventArgs.cs
- TextTreeInsertUndoUnit.cs
- EnumerableCollectionView.cs
- StringExpressionSet.cs
- _ChunkParse.cs
- XmlDocument.cs
- RectKeyFrameCollection.cs
- VScrollProperties.cs
- RoleService.cs
- StyleSelector.cs
- PathNode.cs
- TimeSpan.cs