Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / TimeSpanMinutesConverter.cs / 1305376 / TimeSpanMinutesConverter.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 TimeSpanMinutesConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(TimeSpan)); long data = (long)(((TimeSpan)value).TotalMinutes); 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 = long.Parse((string)data, CultureInfo.InvariantCulture); return TimeSpan.FromMinutes((double)min); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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 TimeSpanMinutesConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(TimeSpan)); long data = (long)(((TimeSpan)value).TotalMinutes); 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 = long.Parse((string)data, CultureInfo.InvariantCulture); return TimeSpan.FromMinutes((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
- ScriptReference.cs
- InputLanguageProfileNotifySink.cs
- AnnotationComponentManager.cs
- Rfc2898DeriveBytes.cs
- MarkedHighlightComponent.cs
- MenuAutomationPeer.cs
- AssemblyInfo.cs
- sqlpipe.cs
- ReadWriteSpinLock.cs
- xmlsaver.cs
- CodeObject.cs
- CodeIterationStatement.cs
- SystemFonts.cs
- SystemDropShadowChrome.cs
- OperationPickerDialog.designer.cs
- GcHandle.cs
- DocumentGridPage.cs
- EntityAdapter.cs
- FactoryRecord.cs
- ReadOnlyAttribute.cs
- ToolConsole.cs
- ControlCachePolicy.cs
- BackgroundFormatInfo.cs
- COAUTHINFO.cs
- PipeStream.cs
- ExtensionDataReader.cs
- SpecialTypeDataContract.cs
- GeometryDrawing.cs
- XPathDocumentIterator.cs
- ComboBox.cs
- LockedAssemblyCache.cs
- DecoderFallback.cs
- LicFileLicenseProvider.cs
- COM2ICategorizePropertiesHandler.cs
- InternalControlCollection.cs
- DataSysAttribute.cs
- DataBindingExpressionBuilder.cs
- UICuesEvent.cs
- SByte.cs
- Panel.cs
- SvcMapFileSerializer.cs
- SafeRightsManagementQueryHandle.cs
- Root.cs
- TransactionFlowOption.cs
- SafeEventHandle.cs
- WeakHashtable.cs
- Timeline.cs
- NameScope.cs
- EntityKey.cs
- ColumnMapTranslator.cs
- FontStyles.cs
- XmlSerializationReader.cs
- DrawTreeNodeEventArgs.cs
- IProducerConsumerCollection.cs
- Rotation3D.cs
- UnaryNode.cs
- CfgArc.cs
- Polyline.cs
- QilReference.cs
- WriterOutput.cs
- PropVariant.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- StateBag.cs
- TaskFactory.cs
- ToolStripDropDownItem.cs
- ToolStripContentPanel.cs
- PtsContext.cs
- DispatcherEventArgs.cs
- WindowsHyperlink.cs
- ComponentManagerBroker.cs
- RegexStringValidatorAttribute.cs
- Point3DAnimationUsingKeyFrames.cs
- InternalConfigHost.cs
- TraceHandlerErrorFormatter.cs
- LifetimeServices.cs
- ISO2022Encoding.cs
- CaseInsensitiveComparer.cs
- ChangeInterceptorAttribute.cs
- SQLString.cs
- ConfigurationManagerInternalFactory.cs
- Image.cs
- EntityDataSourceState.cs
- DataTableReader.cs
- DataKeyCollection.cs
- EncodingNLS.cs
- RootBrowserWindowAutomationPeer.cs
- LinqDataSourceDeleteEventArgs.cs
- StrokeCollectionConverter.cs
- StrongNameMembershipCondition.cs
- BindingExpression.cs
- GuidelineSet.cs
- XmlNamespaceMapping.cs
- TagPrefixCollection.cs
- ThreadPoolTaskScheduler.cs
- KeyConstraint.cs
- Bitmap.cs
- TdsParser.cs
- FieldToken.cs
- ButtonBaseAdapter.cs
- coordinatorscratchpad.cs