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
- JsonQueryStringConverter.cs
- FormsAuthenticationCredentials.cs
- ConfigXmlAttribute.cs
- SafeRightsManagementSessionHandle.cs
- BaseCollection.cs
- LayoutExceptionEventArgs.cs
- PaperSize.cs
- SafeSystemMetrics.cs
- MultiSelector.cs
- Publisher.cs
- AppSecurityManager.cs
- IntegrationExceptionEventArgs.cs
- ForwardPositionQuery.cs
- DockPanel.cs
- RtfToken.cs
- BindingMemberInfo.cs
- PagedDataSource.cs
- COM2IPerPropertyBrowsingHandler.cs
- TransactionState.cs
- clipboard.cs
- MediaPlayer.cs
- WindowsPrincipal.cs
- TableItemPattern.cs
- JsonWriter.cs
- System.Data_BID.cs
- CodeGen.cs
- DesignerDataColumn.cs
- MissingMemberException.cs
- Point3DAnimation.cs
- ItemType.cs
- WebResourceUtil.cs
- EntityClassGenerator.cs
- BrowserCapabilitiesFactory.cs
- SqlDataSourceView.cs
- JournalEntryListConverter.cs
- ConfigXmlText.cs
- TrustSection.cs
- BackgroundFormatInfo.cs
- MimeFormatter.cs
- HttpClientCertificate.cs
- SynchronizingStream.cs
- PersonalizationStateInfoCollection.cs
- EntryWrittenEventArgs.cs
- TypeInfo.cs
- InputBuffer.cs
- DataGridRelationshipRow.cs
- ColumnBinding.cs
- FamilyMapCollection.cs
- ToolBarButton.cs
- SerTrace.cs
- TextReader.cs
- CommentEmitter.cs
- SchemaNotation.cs
- LicenseProviderAttribute.cs
- RecordBuilder.cs
- StylusPointPropertyUnit.cs
- ImageFormatConverter.cs
- EastAsianLunisolarCalendar.cs
- Soap.cs
- MaskedTextBox.cs
- ObservableCollection.cs
- SqlTypeConverter.cs
- OperationContext.cs
- FontWeights.cs
- CodeThrowExceptionStatement.cs
- TextPenaltyModule.cs
- WindowsButton.cs
- WebZone.cs
- DataBoundControlAdapter.cs
- Rect3D.cs
- CommonObjectSecurity.cs
- Action.cs
- x509utils.cs
- GridItem.cs
- CodeRemoveEventStatement.cs
- BufferBuilder.cs
- Directory.cs
- TreeView.cs
- Track.cs
- TransformDescriptor.cs
- BinarySerializer.cs
- MethodBuilderInstantiation.cs
- GridViewUpdateEventArgs.cs
- AssemblyHash.cs
- StackOverflowException.cs
- SimpleFileLog.cs
- DataGridCaption.cs
- DesignerAdapterAttribute.cs
- LayoutTableCell.cs
- Stack.cs
- RelationshipType.cs
- NameValueSectionHandler.cs
- PasswordBoxAutomationPeer.cs
- BaseTemplateBuildProvider.cs
- IPAddressCollection.cs
- XslNumber.cs
- TableLayout.cs
- TextWriterEngine.cs
- SchemaImporterExtensionsSection.cs
- URLMembershipCondition.cs