Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / TimeSpanSecondsOrInfiniteConverter.cs / 1305376 / TimeSpanSecondsOrInfiniteConverter.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 TimeSpanSecondsOrInfiniteConverter : TimeSpanSecondsConverter { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(TimeSpan)); if ((TimeSpan)value == TimeSpan.MaxValue) { return "Infinite"; } else { return base.ConvertTo(ctx, ci, value, type); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Debug.Assert(data is string, "data is string"); if ((string)data == "Infinite") { return TimeSpan.MaxValue; } else { return base.ConvertFrom(ctx, ci, data); } } } } // 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
- TraceHandlerErrorFormatter.cs
- webeventbuffer.cs
- ExceptionHelpers.cs
- InputLangChangeRequestEvent.cs
- DBConnectionString.cs
- XPathNodeInfoAtom.cs
- ConfigsHelper.cs
- ServiceDescriptionData.cs
- HttpWriter.cs
- UrlMapping.cs
- OletxEnlistment.cs
- ProtocolsConfigurationEntry.cs
- SqlXmlStorage.cs
- ObjectPropertyMapping.cs
- NTAccount.cs
- Visitor.cs
- EntityCommandExecutionException.cs
- WindowInteractionStateTracker.cs
- objectresult_tresulttype.cs
- ComponentEditorPage.cs
- ArgumentException.cs
- InfoCardMasterKey.cs
- ValidatingPropertiesEventArgs.cs
- HostProtectionException.cs
- RemoteWebConfigurationHostStream.cs
- EventMappingSettingsCollection.cs
- BoundField.cs
- GenericTypeParameterBuilder.cs
- Visitor.cs
- Font.cs
- HostedImpersonationContext.cs
- XPathArrayIterator.cs
- ExpressionLink.cs
- X509ChainPolicy.cs
- NameObjectCollectionBase.cs
- InkCanvas.cs
- XmlSchemaSequence.cs
- PathFigure.cs
- FontDriver.cs
- ContainerUtilities.cs
- CodeCatchClauseCollection.cs
- StorageMappingFragment.cs
- AccessorTable.cs
- OdbcConnectionFactory.cs
- JavaScriptSerializer.cs
- DesignBindingConverter.cs
- Method.cs
- ReflectEventDescriptor.cs
- Parsers.cs
- TextTreeInsertElementUndoUnit.cs
- StatusBarDrawItemEvent.cs
- Visual3DCollection.cs
- SponsorHelper.cs
- XmlILAnnotation.cs
- HttpResponse.cs
- SoapEnumAttribute.cs
- SEHException.cs
- TrackingServices.cs
- ReversePositionQuery.cs
- StorageComplexPropertyMapping.cs
- MessageSecurityOverTcpElement.cs
- XmlMapping.cs
- CheckBoxList.cs
- UTF8Encoding.cs
- Serializer.cs
- XamlDesignerSerializationManager.cs
- WindowShowOrOpenTracker.cs
- ImageListDesigner.cs
- HttpCacheVaryByContentEncodings.cs
- AsymmetricSignatureFormatter.cs
- NetworkAddressChange.cs
- WebAdminConfigurationHelper.cs
- DiscardableAttribute.cs
- EnumConverter.cs
- PathSegment.cs
- PrivilegeNotHeldException.cs
- ConsumerConnectionPointCollection.cs
- WebPartTransformer.cs
- EUCJPEncoding.cs
- ConfigurationPropertyCollection.cs
- ImageFormat.cs
- XmlNodeReader.cs
- InfoCardArgumentException.cs
- UserValidatedEventArgs.cs
- PingOptions.cs
- ReadOnlyCollection.cs
- SystemDiagnosticsSection.cs
- DynamicResourceExtension.cs
- Window.cs
- RequestStatusBarUpdateEventArgs.cs
- XamlSerializerUtil.cs
- Pool.cs
- ToolStripPanel.cs
- SqlTopReducer.cs
- DocumentProperties.cs
- SoundPlayer.cs
- RijndaelManaged.cs
- XmlParserContext.cs
- ServiceProviders.cs
- ScriptModule.cs