Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / ComponentModel / ByteConverter.cs / 1 / ByteConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using Microsoft.Win32;
using System.ComponentModel;
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 8-bit unsigned
/// integer objects to and from various other representations.
///
[HostProtection(SharedState = true)]
public class ByteConverter : BaseNumberConverter {
///
/// The Type this converter is targeting (e.g. Int16, UInt32, etc.)
///
internal override Type TargetType {
get {
return typeof(Byte);
}
}
///
/// Convert the given value to a string using the given radix
///
internal override object FromString(string value, int radix) {
return Convert.ToByte(value, radix);
}
///
/// Convert the given value to a string using the given formatInfo
///
internal override object FromString(string value, NumberFormatInfo formatInfo) {
return Byte.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 Byte.Parse(value, culture);
}
///
/// Convert the given value from a string using the given formatInfo
///
internal override string ToString(object value, NumberFormatInfo formatInfo) {
return ((Byte)value).ToString("G", 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.ComponentModel;
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 8-bit unsigned
/// integer objects to and from various other representations.
///
[HostProtection(SharedState = true)]
public class ByteConverter : BaseNumberConverter {
///
/// The Type this converter is targeting (e.g. Int16, UInt32, etc.)
///
internal override Type TargetType {
get {
return typeof(Byte);
}
}
///
/// Convert the given value to a string using the given radix
///
internal override object FromString(string value, int radix) {
return Convert.ToByte(value, radix);
}
///
/// Convert the given value to a string using the given formatInfo
///
internal override object FromString(string value, NumberFormatInfo formatInfo) {
return Byte.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 Byte.Parse(value, culture);
}
///
/// Convert the given value from a string using the given formatInfo
///
internal override string ToString(object value, NumberFormatInfo formatInfo) {
return ((Byte)value).ToString("G", 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
- AdRotator.cs
- DockAndAnchorLayout.cs
- NameSpaceExtractor.cs
- ClientSettings.cs
- EasingKeyFrames.cs
- CustomTypeDescriptor.cs
- DesignerSerializerAttribute.cs
- TextServicesDisplayAttribute.cs
- DataGridViewColumnHeaderCell.cs
- IPipelineRuntime.cs
- Model3D.cs
- ResizeGrip.cs
- EmptyEnumerator.cs
- _BasicClient.cs
- QueryContinueDragEvent.cs
- SettingsPropertyValueCollection.cs
- QilLoop.cs
- Grid.cs
- ProcessInfo.cs
- DataGridViewEditingControlShowingEventArgs.cs
- TextStore.cs
- DesignerDataRelationship.cs
- ResXResourceSet.cs
- TransformValueSerializer.cs
- CryptoStream.cs
- TypeLoadException.cs
- HWStack.cs
- InternalCache.cs
- ProgressBarBrushConverter.cs
- TypeElementCollection.cs
- ControlUtil.cs
- HttpException.cs
- InputMethodStateTypeInfo.cs
- ResourceReferenceKeyNotFoundException.cs
- TimelineCollection.cs
- CodeAttributeDeclarationCollection.cs
- SizeAnimation.cs
- Propagator.JoinPropagator.cs
- _Connection.cs
- ListItemCollection.cs
- XPathSelfQuery.cs
- FileReservationCollection.cs
- SamlAuthenticationClaimResource.cs
- TimeSpanStorage.cs
- TextComposition.cs
- Renderer.cs
- VisualStyleRenderer.cs
- NetworkAddressChange.cs
- CollectionBuilder.cs
- GridViewActionList.cs
- SparseMemoryStream.cs
- BinaryParser.cs
- SqlCommandSet.cs
- ArgumentNullException.cs
- BooleanStorage.cs
- OleDbRowUpdatingEvent.cs
- Transform.cs
- XamlToRtfParser.cs
- RegisteredArrayDeclaration.cs
- XmlSchemaDocumentation.cs
- InternalTypeHelper.cs
- Set.cs
- RegexGroup.cs
- WsiProfilesElementCollection.cs
- ContextMenuStrip.cs
- XslCompiledTransform.cs
- ServiceDesigner.cs
- Double.cs
- DispatchWrapper.cs
- QueuedDeliveryRequirementsMode.cs
- ScriptMethodAttribute.cs
- HostingEnvironmentException.cs
- System.Data_BID.cs
- GridViewCellAutomationPeer.cs
- WeakReferenceEnumerator.cs
- ScriptManager.cs
- panel.cs
- TableSectionStyle.cs
- UnsafeNativeMethods.cs
- DataFieldConverter.cs
- ChildrenQuery.cs
- ComplexTypeEmitter.cs
- ProviderConnectionPoint.cs
- FileDialog.cs
- IndicFontClient.cs
- HtmlTable.cs
- HtmlTableCellCollection.cs
- MessageQueueInstaller.cs
- NativeMethods.cs
- DataGridViewCellLinkedList.cs
- ISO2022Encoding.cs
- IncrementalCompileAnalyzer.cs
- Array.cs
- ChangePasswordAutoFormat.cs
- Point3DCollectionValueSerializer.cs
- TranslateTransform.cs
- XmlToDatasetMap.cs
- IMembershipProvider.cs
- DetailsViewInsertedEventArgs.cs
- TemplatedWizardStep.cs