Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / UInt16Converter.cs / 1305376 / UInt16Converter.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 16-bit unsigned integer objects to and
/// from various other representations.
///
[HostProtection(SharedState = true)]
public class UInt16Converter : BaseNumberConverter {
///
/// The Type this converter is targeting (e.g. Int16, UInt32, etc.)
///
internal override Type TargetType {
get {
return typeof(UInt16);
}
}
///
/// Convert the given value to a string using the given radix
///
internal override object FromString(string value, int radix) {
return Convert.ToUInt16(value, radix);
}
///
/// Convert the given value to a string using the given formatInfo
///
internal override object FromString(string value, NumberFormatInfo formatInfo) {
return UInt16.Parse(value, NumberStyles.Integer, formatInfo);
}
///
/// Convert the given value to a string using the given CultureInfo
///
internal override object FromString(string value, CultureInfo culture){
return UInt16.Parse(value, culture);
}
///
/// Convert the given value from a string using the given formatInfo
///
internal override string ToString(object value, NumberFormatInfo formatInfo) {
return ((UInt16)value).ToString("G", formatInfo);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// 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 16-bit unsigned integer objects to and
/// from various other representations.
///
[HostProtection(SharedState = true)]
public class UInt16Converter : BaseNumberConverter {
///
/// The Type this converter is targeting (e.g. Int16, UInt32, etc.)
///
internal override Type TargetType {
get {
return typeof(UInt16);
}
}
///
/// Convert the given value to a string using the given radix
///
internal override object FromString(string value, int radix) {
return Convert.ToUInt16(value, radix);
}
///
/// Convert the given value to a string using the given formatInfo
///
internal override object FromString(string value, NumberFormatInfo formatInfo) {
return UInt16.Parse(value, NumberStyles.Integer, formatInfo);
}
///
/// Convert the given value to a string using the given CultureInfo
///
internal override object FromString(string value, CultureInfo culture){
return UInt16.Parse(value, culture);
}
///
/// Convert the given value from a string using the given formatInfo
///
internal override string ToString(object value, NumberFormatInfo formatInfo) {
return ((UInt16)value).ToString("G", formatInfo);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CounterSampleCalculator.cs
- StringAnimationUsingKeyFrames.cs
- ToolboxComponentsCreatedEventArgs.cs
- AuthenticationService.cs
- DataBindingList.cs
- SqlCacheDependencySection.cs
- mda.cs
- BitConverter.cs
- LocalizationParserHooks.cs
- StringFormat.cs
- ListenUriMode.cs
- InfiniteIntConverter.cs
- ExpressionVisitorHelpers.cs
- TextShapeableCharacters.cs
- UpdatePanelTriggerCollection.cs
- GridViewColumnCollectionChangedEventArgs.cs
- Transform3D.cs
- ServiceBusyException.cs
- TextRangeEditTables.cs
- HtmlEncodedRawTextWriter.cs
- PropertyEmitter.cs
- DateTimeParse.cs
- BooleanToVisibilityConverter.cs
- SafeEventLogReadHandle.cs
- ClientTargetSection.cs
- XmlElementAttribute.cs
- UriGenerator.cs
- Peer.cs
- XmlTextEncoder.cs
- SettingsSavedEventArgs.cs
- GridViewRowEventArgs.cs
- VirtualizingPanel.cs
- ToolStripSplitStackLayout.cs
- GridItemPattern.cs
- BitmapEffect.cs
- NavigationCommands.cs
- RegexBoyerMoore.cs
- IDQuery.cs
- ScopelessEnumAttribute.cs
- WebPartActionVerb.cs
- RectangleHotSpot.cs
- ShaderEffect.cs
- FormatVersion.cs
- MediaScriptCommandRoutedEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- DaylightTime.cs
- TagMapCollection.cs
- SafeCoTaskMem.cs
- DBCommandBuilder.cs
- BindingOperations.cs
- UIElementParaClient.cs
- SymbolMethod.cs
- PageEventArgs.cs
- DataGridLinkButton.cs
- XmlText.cs
- FactoryMaker.cs
- BrowserCapabilitiesFactoryBase.cs
- ZoneButton.cs
- FormsAuthenticationEventArgs.cs
- ApplicationFileCodeDomTreeGenerator.cs
- GroupBoxRenderer.cs
- DataGridTable.cs
- Command.cs
- WebPartEventArgs.cs
- ReadOnlyAttribute.cs
- LinearQuaternionKeyFrame.cs
- Error.cs
- ViewStateModeByIdAttribute.cs
- DataBoundControlHelper.cs
- AnnotationComponentManager.cs
- BamlReader.cs
- ConstructorExpr.cs
- CookieProtection.cs
- StyleXamlTreeBuilder.cs
- TextProperties.cs
- XPathSelfQuery.cs
- AlternateView.cs
- ProcessModule.cs
- HandledEventArgs.cs
- CodeNamespaceImportCollection.cs
- login.cs
- SessionIDManager.cs
- UrlAuthorizationModule.cs
- XmlChildEnumerator.cs
- ListenerElementsCollection.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- FlowLayoutPanel.cs
- XPathNavigatorReader.cs
- ClientTargetCollection.cs
- FixedSOMPageConstructor.cs
- indexingfiltermarshaler.cs
- EventLogEntry.cs
- TextProperties.cs
- TcpClientSocketManager.cs
- ErrorLog.cs
- MembershipUser.cs
- ExceptionHandlers.cs
- TaskSchedulerException.cs
- ClientTarget.cs
- RegexCapture.cs