Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / TimeSpanSecondsConverter.cs / 1305376 / TimeSpanSecondsConverter.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 class TimeSpanSecondsConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(TimeSpan)); long data = (long)(((TimeSpan)value).TotalSeconds); return data.ToString(CultureInfo.InvariantCulture); } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Debug.Assert(data is string, "data is string"); long min = 0; try { min = long.Parse((string)data, CultureInfo.InvariantCulture); } catch { throw new ArgumentException(SR.GetString(SR.Converter_timespan_not_in_second)); } return TimeSpan.FromSeconds((double)min); } } } // 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
- DependentList.cs
- ResizeGrip.cs
- EncoderFallback.cs
- HtmlAnchor.cs
- ProgressBarRenderer.cs
- X509Chain.cs
- ObjectTokenCategory.cs
- ExternalCalls.cs
- BlurBitmapEffect.cs
- HMACSHA256.cs
- DirectionalLight.cs
- UndoUnit.cs
- HwndSourceParameters.cs
- TabControl.cs
- RootDesignerSerializerAttribute.cs
- SqlGenericUtil.cs
- WrapperEqualityComparer.cs
- ByteStorage.cs
- CodeSnippetStatement.cs
- ContextItem.cs
- LateBoundBitmapDecoder.cs
- ComEventsMethod.cs
- ServiceProviders.cs
- ToolStripLabel.cs
- ResourceProviderFactory.cs
- ListSourceHelper.cs
- EnumBuilder.cs
- PlainXmlDeserializer.cs
- PagerSettings.cs
- Point3DAnimation.cs
- HttpStreamMessage.cs
- GregorianCalendar.cs
- WindowManager.cs
- DbParameterCollection.cs
- StreamAsIStream.cs
- connectionpool.cs
- SoapHttpTransportImporter.cs
- AssociationEndMember.cs
- DodSequenceMerge.cs
- TableCell.cs
- DesignTimeTemplateParser.cs
- DataGridViewColumn.cs
- HttpConfigurationSystem.cs
- ActiveXMessageFormatter.cs
- DictionaryManager.cs
- FilteredXmlReader.cs
- NativeMethods.cs
- SortableBindingList.cs
- ErrorView.xaml.cs
- DocumentApplicationState.cs
- _NativeSSPI.cs
- ThousandthOfEmRealDoubles.cs
- WebPartDisplayModeEventArgs.cs
- FixedSOMLineRanges.cs
- Parameter.cs
- InheritanceRules.cs
- ActivityStateRecord.cs
- FileDialog_Vista_Interop.cs
- NumericUpDownAccelerationCollection.cs
- FixedDSBuilder.cs
- CustomAttributeFormatException.cs
- VerticalConnector.xaml.cs
- TopClause.cs
- DataGridPagerStyle.cs
- PrivilegeNotHeldException.cs
- ChameleonKey.cs
- ExpressionBuilderCollection.cs
- ObjectParameterCollection.cs
- SafeTimerHandle.cs
- BooleanFunctions.cs
- Control.cs
- CodeLabeledStatement.cs
- TableDetailsRow.cs
- DataObjectAttribute.cs
- SpecialTypeDataContract.cs
- TextViewElement.cs
- SoapSchemaExporter.cs
- AutoResizedEvent.cs
- ErrorLog.cs
- ResponseStream.cs
- NamespaceCollection.cs
- RegexTypeEditor.cs
- IpcClientManager.cs
- TabItemWrapperAutomationPeer.cs
- XmlSequenceWriter.cs
- HtmlInputCheckBox.cs
- PtsHelper.cs
- XmlHelper.cs
- ShapingWorkspace.cs
- FixedSOMSemanticBox.cs
- ProbeRequestResponseAsyncResult.cs
- StateItem.cs
- MediaPlayer.cs
- ClientProtocol.cs
- XmlDocumentType.cs
- FilterException.cs
- RevocationPoint.cs
- EntityClientCacheEntry.cs
- XdrBuilder.cs
- FilterableAttribute.cs