Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / InfiniteIntConverter.cs / 1305376 / 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
- FacetChecker.cs
- PolyBezierSegmentFigureLogic.cs
- CardSpaceException.cs
- XPathNavigatorReader.cs
- TextEvent.cs
- ModuleElement.cs
- GlyphCollection.cs
- XmlSchemaIdentityConstraint.cs
- HitTestWithPointDrawingContextWalker.cs
- ArrangedElement.cs
- WebPartConnectionsEventArgs.cs
- ImageResources.Designer.cs
- AssemblyFilter.cs
- VirtualPathUtility.cs
- MapPathBasedVirtualPathProvider.cs
- TextPenaltyModule.cs
- CodeLabeledStatement.cs
- ISCIIEncoding.cs
- Vector3D.cs
- UserPrincipalNameElement.cs
- LineServicesCallbacks.cs
- InstanceLockTracking.cs
- EntityWrapperFactory.cs
- MessageLoggingElement.cs
- URI.cs
- ResXDataNode.cs
- _ChunkParse.cs
- TdsParserStaticMethods.cs
- SendMailErrorEventArgs.cs
- KeyFrames.cs
- EncoderBestFitFallback.cs
- MetadataHelper.cs
- ToolStripContentPanel.cs
- StatusBarPanel.cs
- ClipboardProcessor.cs
- ZipIORawDataFileBlock.cs
- AnonymousIdentificationModule.cs
- ProgressBarHighlightConverter.cs
- SoapIgnoreAttribute.cs
- Latin1Encoding.cs
- SqlDataSourceCustomCommandPanel.cs
- TreeBuilder.cs
- TemplateModeChangedEventArgs.cs
- BasicHttpBindingCollectionElement.cs
- X509Certificate2Collection.cs
- OletxResourceManager.cs
- SchemaTypeEmitter.cs
- TextTreeDeleteContentUndoUnit.cs
- ApplicationSecurityManager.cs
- StateWorkerRequest.cs
- SearchForVirtualItemEventArgs.cs
- ContainerControl.cs
- DataGridHeaderBorder.cs
- Compiler.cs
- HiddenField.cs
- ImageInfo.cs
- GuidTagList.cs
- CheckPair.cs
- ProcessHostMapPath.cs
- ScriptingRoleServiceSection.cs
- IntSecurity.cs
- Update.cs
- AuthorizationRuleCollection.cs
- TableAdapterManagerMethodGenerator.cs
- Vector3DValueSerializer.cs
- TabControlAutomationPeer.cs
- SafeCryptContextHandle.cs
- HttpRawResponse.cs
- FragmentQueryKB.cs
- clipboard.cs
- StreamGeometry.cs
- StringToken.cs
- HtmlButton.cs
- WebSysDescriptionAttribute.cs
- XmlNodeChangedEventArgs.cs
- CallContext.cs
- ProcessThreadCollection.cs
- CoTaskMemUnicodeSafeHandle.cs
- RegexBoyerMoore.cs
- TabPanel.cs
- BaseValidator.cs
- ContourSegment.cs
- HttpBrowserCapabilitiesBase.cs
- COM2EnumConverter.cs
- DynamicPropertyHolder.cs
- SurrogateDataContract.cs
- DataGridViewCellStyle.cs
- HostExecutionContextManager.cs
- FocusManager.cs
- HtmlToClrEventProxy.cs
- SmiConnection.cs
- X509AsymmetricSecurityKey.cs
- X509Certificate.cs
- XmlSiteMapProvider.cs
- metrodevice.cs
- DbConnectionInternal.cs
- UrlPropertyAttribute.cs
- ResourceCollectionInfo.cs
- RectAnimationUsingKeyFrames.cs
- ContractCodeDomInfo.cs