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
- DefaultValidator.cs
- FormattedText.cs
- ObjectAnimationBase.cs
- FormatterServices.cs
- CacheForPrimitiveTypes.cs
- ToolStripItemImageRenderEventArgs.cs
- CodeBlockBuilder.cs
- LinqDataSourceStatusEventArgs.cs
- Size3DConverter.cs
- ProxyElement.cs
- IntSecurity.cs
- LinqDataSourceSelectEventArgs.cs
- TypeUtil.cs
- ColumnWidthChangedEvent.cs
- PriorityQueue.cs
- EntityStoreSchemaGenerator.cs
- EntityContainerEntitySetDefiningQuery.cs
- FocusManager.cs
- PageCatalogPartDesigner.cs
- MetafileEditor.cs
- AssemblyCacheEntry.cs
- DefaultValueTypeConverter.cs
- PingReply.cs
- IntegerValidator.cs
- RangeBaseAutomationPeer.cs
- SchemaNames.cs
- CodeTypeDelegate.cs
- PostBackOptions.cs
- ResolveCriteriaCD1.cs
- AudioSignalProblemOccurredEventArgs.cs
- JsonWriter.cs
- ArgumentException.cs
- PageAsyncTaskManager.cs
- UserControlAutomationPeer.cs
- BindingsCollection.cs
- Vector.cs
- InfiniteIntConverter.cs
- SqlLiftIndependentRowExpressions.cs
- listitem.cs
- DSACryptoServiceProvider.cs
- Int64Converter.cs
- IsolatedStoragePermission.cs
- ScriptingProfileServiceSection.cs
- PersonalizationAdministration.cs
- CellParaClient.cs
- Task.cs
- BitmapEncoder.cs
- MissingSatelliteAssemblyException.cs
- Timer.cs
- TypedColumnHandler.cs
- TextViewBase.cs
- RoutedEventArgs.cs
- ClassHandlersStore.cs
- MembershipUser.cs
- DateTimeSerializationSection.cs
- CollectionViewGroup.cs
- SafeNativeMethodsCLR.cs
- TreeNodeStyleCollection.cs
- UnSafeCharBuffer.cs
- TextTreeObjectNode.cs
- DesignerActionTextItem.cs
- Win32Exception.cs
- DataGridViewCellValueEventArgs.cs
- PropertyManager.cs
- GenericParameterDataContract.cs
- ObjectDataSourceMethodEventArgs.cs
- SqlGatherProducedAliases.cs
- SelectedDatesCollection.cs
- ViewStateException.cs
- SupportingTokenListenerFactory.cs
- RenderCapability.cs
- MinimizableAttributeTypeConverter.cs
- MessageProperties.cs
- CriticalHandle.cs
- HideDisabledControlAdapter.cs
- SafeNativeMethods.cs
- ArraySegment.cs
- ConfigurationManagerInternal.cs
- BigInt.cs
- Rotation3D.cs
- BooleanKeyFrameCollection.cs
- ButtonChrome.cs
- XmlValidatingReader.cs
- ArrangedElementCollection.cs
- ThreadStateException.cs
- LocalizationParserHooks.cs
- XmlSchemaExternal.cs
- Columns.cs
- ItemMap.cs
- DelegateTypeInfo.cs
- DefaultDiscoveryServiceExtension.cs
- PageSettings.cs
- GPRECTF.cs
- MailSettingsSection.cs
- HttpDictionary.cs
- WebPartMinimizeVerb.cs
- ProvidersHelper.cs
- DataGridViewComboBoxEditingControl.cs
- Attributes.cs
- parserscommon.cs