Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Configuration / System / Configuration / InfiniteIntConverter.cs / 1 / InfiniteIntConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { public sealed class InfiniteIntConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(int)); if ((int)value == int.MaxValue) { return "Infinite"; } else { return ((int)value).ToString(CultureInfo.InvariantCulture); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Debug.Assert(data is string, "data is string"); if ((string)data == "Infinite") { return int.MaxValue; } else { return Convert.ToInt32((string)data, 10); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { public sealed class InfiniteIntConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(int)); if ((int)value == int.MaxValue) { return "Infinite"; } else { return ((int)value).ToString(CultureInfo.InvariantCulture); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Debug.Assert(data is string, "data is string"); if ((string)data == "Infinite") { return int.MaxValue; } else { return Convert.ToInt32((string)data, 10); } } } } // 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
- ErrorRuntimeConfig.cs
- SessionEndingEventArgs.cs
- DirectoryNotFoundException.cs
- InputReferenceExpression.cs
- EnumBuilder.cs
- Missing.cs
- BinaryMessageEncoder.cs
- EDesignUtil.cs
- WindowsFormsLinkLabel.cs
- CompilerGeneratedAttribute.cs
- ItemCheckedEvent.cs
- ResourceCategoryAttribute.cs
- ResizingMessageFilter.cs
- PrimitiveRenderer.cs
- DragDeltaEventArgs.cs
- XhtmlBasicListAdapter.cs
- WindowsContainer.cs
- EntityWithKeyStrategy.cs
- ClientCultureInfo.cs
- CustomCredentialPolicy.cs
- Int32.cs
- Point.cs
- DataGridState.cs
- AsyncOperationManager.cs
- MemoryMappedViewStream.cs
- ArraySegment.cs
- IsolatedStorageException.cs
- HttpCapabilitiesBase.cs
- XmlSiteMapProvider.cs
- TdsRecordBufferSetter.cs
- SudsWriter.cs
- MetabaseSettingsIis7.cs
- ContextMenuAutomationPeer.cs
- ImagingCache.cs
- BitmapCodecInfoInternal.cs
- DispatchWrapper.cs
- ProxyAttribute.cs
- SecureConversationServiceCredential.cs
- ColorContext.cs
- HtmlElementEventArgs.cs
- ContainerParaClient.cs
- HashHelper.cs
- FrameworkContentElement.cs
- DataSourceHelper.cs
- GridItemCollection.cs
- WorkflowViewManager.cs
- SchemaTypeEmitter.cs
- DirectoryObjectSecurity.cs
- TextPatternIdentifiers.cs
- CounterNameConverter.cs
- XPathCompileException.cs
- PathStreamGeometryContext.cs
- CLSCompliantAttribute.cs
- HttpAsyncResult.cs
- MembershipPasswordException.cs
- SimpleNameService.cs
- ObjectItemConventionAssemblyLoader.cs
- Knowncolors.cs
- ElementNotEnabledException.cs
- SamlAuthenticationStatement.cs
- IISMapPath.cs
- HMAC.cs
- XmlSchemaAttributeGroup.cs
- InkPresenterAutomationPeer.cs
- BitmapCacheBrush.cs
- LinearGradientBrush.cs
- DataRelationCollection.cs
- Convert.cs
- PerformanceCountersElement.cs
- QueryReaderSettings.cs
- StateInitializationDesigner.cs
- StringAnimationBase.cs
- DocumentReferenceCollection.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- DoubleAnimationClockResource.cs
- ProvideValueServiceProvider.cs
- ArcSegment.cs
- TemplateBuilder.cs
- TdsParserStateObject.cs
- ByteArrayHelperWithString.cs
- ReceiveActivityDesignerTheme.cs
- LoginName.cs
- EntityDataSourceChangedEventArgs.cs
- OleDbMetaDataFactory.cs
- XsdCachingReader.cs
- ApplicationServiceHelper.cs
- NavigationPropertyEmitter.cs
- RemoteWebConfigurationHost.cs
- ServiceProviders.cs
- Storyboard.cs
- COM2FontConverter.cs
- SourceFileInfo.cs
- InputMethodStateTypeInfo.cs
- NotifyInputEventArgs.cs
- ListViewDeleteEventArgs.cs
- DataGridViewCellCollection.cs
- IpcClientChannel.cs
- MultiView.cs
- XmlSchemaAll.cs
- ReadOnlyPropertyMetadata.cs