Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / InfiniteIntConverter.cs / 1 / InfiniteIntConverter.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 InfiniteIntConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(int)); if ((int)value == int.MaxValue) { return "Infinite"; } else { return ((int)value).ToString(CultureInfo.InvariantCulture); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Debug.Assert(data is string, "data is string"); if ((string)data == "Infinite") { return int.MaxValue; } else { return Convert.ToInt32((string)data, 10); } } } } // 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 sealed class InfiniteIntConverter : ConfigurationConverterBase { public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(int)); if ((int)value == int.MaxValue) { return "Infinite"; } else { return ((int)value).ToString(CultureInfo.InvariantCulture); } } public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { Debug.Assert(data is string, "data is string"); if ((string)data == "Infinite") { return int.MaxValue; } else { return Convert.ToInt32((string)data, 10); } } } } // 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
- SingleStorage.cs
- CodeGen.cs
- StorageMappingFragment.cs
- Propagator.ExtentPlaceholderCreator.cs
- ClientSession.cs
- ThreadNeutralSemaphore.cs
- CompositeDataBoundControl.cs
- FileNotFoundException.cs
- SpeechDetectedEventArgs.cs
- EntityWithChangeTrackerStrategy.cs
- RootProjectionNode.cs
- Rotation3DKeyFrameCollection.cs
- LabelEditEvent.cs
- SingleConverter.cs
- VariantWrapper.cs
- DataColumnPropertyDescriptor.cs
- FixedStringLookup.cs
- XmlArrayAttribute.cs
- CrossContextChannel.cs
- PropertySourceInfo.cs
- LineInfo.cs
- SoapMessage.cs
- FaultHandlingFilter.cs
- DoubleCollectionConverter.cs
- SuppressMergeCheckAttribute.cs
- ErrorFormatterPage.cs
- TextRunCacheImp.cs
- CodeExpressionStatement.cs
- TemplateControlBuildProvider.cs
- OdbcDataReader.cs
- CacheAxisQuery.cs
- QueryResponse.cs
- assemblycache.cs
- OletxEnlistment.cs
- SafeHandle.cs
- TextBoxAutoCompleteSourceConverter.cs
- IPGlobalProperties.cs
- DesignerObjectListAdapter.cs
- MarkerProperties.cs
- IsolatedStorage.cs
- CommandHelper.cs
- OdbcPermission.cs
- SqlIdentifier.cs
- CaseInsensitiveOrdinalStringComparer.cs
- BooleanAnimationBase.cs
- ConstraintManager.cs
- AuthenticationManager.cs
- CompModSwitches.cs
- SQLInt16Storage.cs
- ThreadInterruptedException.cs
- XsltContext.cs
- NestPullup.cs
- Vector3DValueSerializer.cs
- BezierSegment.cs
- ObjectSet.cs
- prefixendpointaddressmessagefiltertable.cs
- WindowsMenu.cs
- Faults.cs
- DetailsViewDeleteEventArgs.cs
- MethodSignatureGenerator.cs
- SafeFindHandle.cs
- DebuggerAttributes.cs
- QueueException.cs
- RootBrowserWindowAutomationPeer.cs
- EndPoint.cs
- DetailsViewModeEventArgs.cs
- RecognizerInfo.cs
- BeginCreateSecurityTokenRequest.cs
- ReaderOutput.cs
- _AuthenticationState.cs
- RequestCacheValidator.cs
- _NTAuthentication.cs
- diagnosticsswitches.cs
- Utils.cs
- DefaultValidator.cs
- CircleEase.cs
- SQLGuidStorage.cs
- VSWCFServiceContractGenerator.cs
- ComboBox.cs
- UnauthorizedWebPart.cs
- AssemblyHash.cs
- Token.cs
- ProcessProtocolHandler.cs
- Condition.cs
- ExpressionLexer.cs
- XmlSchemaElement.cs
- SessionPageStatePersister.cs
- DiscoveryServerProtocol.cs
- BitArray.cs
- XmlBindingWorker.cs
- XmlDocumentSerializer.cs
- MdImport.cs
- InternalConfigConfigurationFactory.cs
- RSAPKCS1SignatureDeformatter.cs
- LinqExpressionNormalizer.cs
- MemberHolder.cs
- TwoPhaseCommit.cs
- GroupItemAutomationPeer.cs
- InternalPermissions.cs
- MouseEventArgs.cs