Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / System.Runtime.DurableInstancing / System / Runtime / TimeSpanOrInfiniteConverter.cs / 1305376 / TimeSpanOrInfiniteConverter.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Runtime { using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.ComponentModel; [SuppressMessage(FxCop.Category.Xaml, FxCop.Rule.TypeConvertersMustBePublic, Justification = "Only used by discovery, which doesn't support PT")] class TimeSpanOrInfiniteConverter : TimeSpanConverter { public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cultureInfo, object value, Type type) { if (value == null) { throw Fx.Exception.ArgumentNull("value"); } if (!(value is TimeSpan)) { throw Fx.Exception.Argument("value", SRCore.IncompatibleArgumentType(typeof(TimeSpan), value.GetType())); } if ((TimeSpan)value == TimeSpan.MaxValue) { return "Infinite"; } else { return base.ConvertTo(context, cultureInfo, value, type); } } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo cultureInfo, object data) { if (string.Equals((string)data, "infinite", StringComparison.OrdinalIgnoreCase)) { return TimeSpan.MaxValue; } else { return base.ConvertFrom(context, cultureInfo, 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
- TreeNodeStyleCollection.cs
- XmlSerializerVersionAttribute.cs
- TdsParserSessionPool.cs
- PerformanceCounterPermissionEntryCollection.cs
- EventKeyword.cs
- DependentList.cs
- PtsContext.cs
- SortExpressionBuilder.cs
- ExpressionBuilderCollection.cs
- SystemIcmpV4Statistics.cs
- RelatedView.cs
- XmlHierarchyData.cs
- IApplicationTrustManager.cs
- WebReferencesBuildProvider.cs
- CollectionChangedEventManager.cs
- SafeRegistryKey.cs
- ScriptingRoleServiceSection.cs
- MessageHeaderInfoTraceRecord.cs
- followingquery.cs
- SimpleWorkerRequest.cs
- Simplifier.cs
- ProgressiveCrcCalculatingStream.cs
- StylusOverProperty.cs
- ObjectDataSourceFilteringEventArgs.cs
- PathStreamGeometryContext.cs
- MergeFailedEvent.cs
- ProxyHelper.cs
- TextUtf8RawTextWriter.cs
- FlowNode.cs
- DefaultTextStoreTextComposition.cs
- TranslateTransform3D.cs
- XamlBrushSerializer.cs
- ErrorHandler.cs
- HttpPostLocalhostServerProtocol.cs
- ToolBar.cs
- ConnectAlgorithms.cs
- SqlCachedBuffer.cs
- EncryptedPackageFilter.cs
- FormsAuthenticationModule.cs
- EventLogHandle.cs
- HighContrastHelper.cs
- SerializerDescriptor.cs
- ReachObjectContext.cs
- DataProtection.cs
- QuaternionRotation3D.cs
- FlowDocumentReader.cs
- MenuAdapter.cs
- AxHost.cs
- GZipDecoder.cs
- DataGridTextBox.cs
- XNodeNavigator.cs
- ToolStripPanelCell.cs
- Win32.cs
- PrimarySelectionAdorner.cs
- DesignerVerb.cs
- PieceDirectory.cs
- CodeArgumentReferenceExpression.cs
- WindowsTab.cs
- Barrier.cs
- SimpleLine.cs
- ListItemDetailViewAttribute.cs
- Evidence.cs
- TagNameToTypeMapper.cs
- ObjectTypeMapping.cs
- DefaultPrintController.cs
- UIElementIsland.cs
- PrePostDescendentsWalker.cs
- FreezableDefaultValueFactory.cs
- AutoResetEvent.cs
- RoleManagerEventArgs.cs
- HideDisabledControlAdapter.cs
- NetTcpSecurityElement.cs
- ActivatableWorkflowsQueryResult.cs
- EncodingDataItem.cs
- EtwTrace.cs
- GenericRootAutomationPeer.cs
- _DisconnectOverlappedAsyncResult.cs
- DataGridComponentEditor.cs
- TextEditorMouse.cs
- KeyManager.cs
- CacheAxisQuery.cs
- ComponentResourceKeyConverter.cs
- XmlNodeComparer.cs
- XhtmlTextWriter.cs
- Bidi.cs
- DynamicPropertyHolder.cs
- HierarchicalDataTemplate.cs
- ToolStripContentPanelDesigner.cs
- Lasso.cs
- TypeDelegator.cs
- CriticalFinalizerObject.cs
- DataSourceDescriptorCollection.cs
- URLString.cs
- RequestTimeoutManager.cs
- ConstructorExpr.cs
- ToolStripRenderer.cs
- AttachmentCollection.cs
- InfoCardBaseException.cs
- DataGridViewRowCollection.cs
- xml.cs