Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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;
///
/// Provides a type
/// converter to convert single-precision, floating point number objects to and from various other
/// representations.
///
[HostProtection(SharedState = true)]
public class SingleConverter : 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(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;
///
/// Provides a type
/// converter to convert single-precision, floating point number objects to and from various other
/// representations.
///
[HostProtection(SharedState = true)]
public class SingleConverter : 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(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
- RenameRuleObjectDialog.cs
- Bold.cs
- ListItemCollection.cs
- PathNode.cs
- ThousandthOfEmRealDoubles.cs
- CloudCollection.cs
- HttpStreamFormatter.cs
- XPathNodeList.cs
- RuntimeCompatibilityAttribute.cs
- IList.cs
- ComplexTypeEmitter.cs
- FileClassifier.cs
- EncryptedPackageFilter.cs
- HyperLink.cs
- WsdlImporterElement.cs
- ActiveDocumentEvent.cs
- RepeaterItemCollection.cs
- BrowserCapabilitiesFactory.cs
- SourceSwitch.cs
- StylusShape.cs
- HostingEnvironmentWrapper.cs
- WebSysDefaultValueAttribute.cs
- CompilerError.cs
- DBCommandBuilder.cs
- DataObjectEventArgs.cs
- shaperfactoryquerycacheentry.cs
- PropertyStore.cs
- ButtonRenderer.cs
- ReliableSessionElement.cs
- EUCJPEncoding.cs
- CustomSignedXml.cs
- ScrollViewer.cs
- ExpressionEditorAttribute.cs
- DeadCharTextComposition.cs
- ToolstripProfessionalRenderer.cs
- CodeIterationStatement.cs
- UnsafeNativeMethods.cs
- baseshape.cs
- ReadOnlyCollection.cs
- AmbientValueAttribute.cs
- OdbcConnectionFactory.cs
- AddInPipelineAttributes.cs
- DocumentOutline.cs
- typedescriptorpermissionattribute.cs
- CustomValidator.cs
- SourceInterpreter.cs
- OSFeature.cs
- CompilerErrorCollection.cs
- ActivityTrace.cs
- Grammar.cs
- SqlDataSourceView.cs
- OdbcParameter.cs
- StringSorter.cs
- SqlDataAdapter.cs
- SchemaManager.cs
- NetworkCredential.cs
- CompositeFontInfo.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ViewStateModeByIdAttribute.cs
- TaiwanLunisolarCalendar.cs
- DeviceSpecificDesigner.cs
- ImageCodecInfoPrivate.cs
- SqlNotificationRequest.cs
- DataGridViewTextBoxEditingControl.cs
- ContentDisposition.cs
- _NetRes.cs
- ExpressionVisitor.cs
- DispatcherOperation.cs
- ObjectMemberMapping.cs
- PropertyTabAttribute.cs
- PropertyRef.cs
- RegexStringValidatorAttribute.cs
- IsolatedStorageFileStream.cs
- TraceRecord.cs
- BinaryNode.cs
- XmlDocumentFragment.cs
- oledbconnectionstring.cs
- WindowsListViewGroupHelper.cs
- BitmapEffectvisualstate.cs
- DesignerDeviceConfig.cs
- xamlnodes.cs
- LoadedOrUnloadedOperation.cs
- ConnectionStringsSection.cs
- Attributes.cs
- StorageRoot.cs
- Splitter.cs
- WebReferencesBuildProvider.cs
- ProxyAttribute.cs
- XamlBrushSerializer.cs
- XsltInput.cs
- HtmlShim.cs
- PieceDirectory.cs
- ToolboxDataAttribute.cs
- ColumnPropertiesGroup.cs
- _SslState.cs
- DelegateBodyWriter.cs
- FtpRequestCacheValidator.cs
- Bitmap.cs
- SessionSwitchEventArgs.cs
- Point3DKeyFrameCollection.cs