Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / InfiniteTimeSpanConverter.cs / 1305376 / InfiniteTimeSpanConverter.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 InfiniteTimeSpanConverter : ConfigurationConverterBase { static readonly TypeConverter s_TimeSpanConverter = TypeDescriptor.GetConverter(typeof(TimeSpan)); 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 s_TimeSpanConverter.ConvertToInvariantString(value); } } 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 s_TimeSpanConverter.ConvertFromInvariantString((string)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
- RectangleConverter.cs
- WindowsTokenRoleProvider.cs
- ExpressionPrinter.cs
- SessionState.cs
- XmlQueryCardinality.cs
- ProgressBarRenderer.cs
- WorkflowApplicationException.cs
- DesignerInterfaces.cs
- Queue.cs
- QueryPrefixOp.cs
- TimeIntervalCollection.cs
- HwndStylusInputProvider.cs
- ScrollPatternIdentifiers.cs
- InputChannelBinder.cs
- RightsManagementInformation.cs
- MouseButtonEventArgs.cs
- FileLoadException.cs
- SourceInterpreter.cs
- Converter.cs
- SafeHandles.cs
- CallTemplateAction.cs
- ExtendedProtectionPolicy.cs
- ThreadAbortException.cs
- DependencyObjectProvider.cs
- WrappedIUnknown.cs
- TextOutput.cs
- SyndicationSerializer.cs
- CommandID.cs
- User.cs
- OleDbReferenceCollection.cs
- DetailsViewModeEventArgs.cs
- UrlMappingCollection.cs
- RelationshipType.cs
- FilteredAttributeCollection.cs
- DataGridAutoFormat.cs
- Point3D.cs
- ViewValidator.cs
- WindowsUpDown.cs
- MappingModelBuildProvider.cs
- XPathExpr.cs
- XPathItem.cs
- BindingNavigator.cs
- M3DUtil.cs
- regiisutil.cs
- TextParagraphProperties.cs
- DirectionalLight.cs
- StringSource.cs
- DbSourceParameterCollection.cs
- TimeSpanSecondsConverter.cs
- SecurityContext.cs
- ResourceExpressionBuilder.cs
- BitmapEffectDrawing.cs
- HttpHandlerActionCollection.cs
- GradientStopCollection.cs
- HighlightComponent.cs
- StoreItemCollection.Loader.cs
- LingerOption.cs
- CustomSignedXml.cs
- BitmapEffectOutputConnector.cs
- TraceContextEventArgs.cs
- SingletonInstanceContextProvider.cs
- XmlSchemaImport.cs
- NameValueCollection.cs
- DocumentXmlWriter.cs
- JavascriptCallbackBehaviorAttribute.cs
- Line.cs
- QuadraticBezierSegment.cs
- ThreadPoolTaskScheduler.cs
- PropertyToken.cs
- CompressEmulationStream.cs
- TemplateBindingExtension.cs
- ToolbarAUtomationPeer.cs
- ErrorStyle.cs
- PerformanceCounterPermissionAttribute.cs
- ToolStripMenuItemDesigner.cs
- FlowDocumentPage.cs
- UpdatePanelControlTrigger.cs
- DriveNotFoundException.cs
- Point.cs
- DeadCharTextComposition.cs
- XmlNodeWriter.cs
- SvcMapFileLoader.cs
- ExecutionContext.cs
- LambdaCompiler.Statements.cs
- Qualifier.cs
- NamedObject.cs
- TextSelectionHighlightLayer.cs
- ExpressionConverter.cs
- ApplicationBuildProvider.cs
- OneOfConst.cs
- Monitor.cs
- CharEnumerator.cs
- WaitForChangedResult.cs
- xmlglyphRunInfo.cs
- JsonObjectDataContract.cs
- ProtocolsConfigurationHandler.cs
- LinkTarget.cs
- FixedSOMPageConstructor.cs
- FontNameEditor.cs
- basecomparevalidator.cs