Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / ThrowOnMultipleAssignment.cs / 1305376 / ThrowOnMultipleAssignment.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using Microsoft.InfoCards.Diagnostics; using IDT=Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary: // This class throws an Argument exception if an attempt is made to assign a non-null // value to the Value property more than once. // class ThrowOnMultipleAssignment{ string m_errorString; T m_value; public T Value { get { return m_value; } set { if( null != m_value && null != value ) { throw IDT.ThrowHelperArgument( m_errorString ); } else if( null == m_value ) { m_value = value; } } } // // Parameters: // errorString - If Value gets assigned to more than once an argument exception will be thrown with this // string as the Exception string. // public ThrowOnMultipleAssignment( string errorString ) { IDT.DebugAssert( !String.IsNullOrEmpty( errorString ), "Must have an error string" ); m_errorString = errorString; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using Microsoft.InfoCards.Diagnostics; using IDT=Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary: // This class throws an Argument exception if an attempt is made to assign a non-null // value to the Value property more than once. // class ThrowOnMultipleAssignment { string m_errorString; T m_value; public T Value { get { return m_value; } set { if( null != m_value && null != value ) { throw IDT.ThrowHelperArgument( m_errorString ); } else if( null == m_value ) { m_value = value; } } } // // Parameters: // errorString - If Value gets assigned to more than once an argument exception will be thrown with this // string as the Exception string. // public ThrowOnMultipleAssignment( string errorString ) { IDT.DebugAssert( !String.IsNullOrEmpty( errorString ), "Must have an error string" ); m_errorString = errorString; } } } // 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
- IndexerNameAttribute.cs
- RadioButton.cs
- ExpanderAutomationPeer.cs
- SafeHandle.cs
- TemplateBaseAction.cs
- ConnectorEditor.cs
- XmlQueryType.cs
- GridSplitterAutomationPeer.cs
- XmlnsDefinitionAttribute.cs
- NonParentingControl.cs
- DocumentViewer.cs
- DependencyPropertyHelper.cs
- Variable.cs
- InboundActivityHelper.cs
- GridViewEditEventArgs.cs
- ProviderException.cs
- HandleExceptionArgs.cs
- PageSettings.cs
- LiteralLink.cs
- TreeView.cs
- EntitySqlQueryBuilder.cs
- TranslateTransform.cs
- CoTaskMemHandle.cs
- HostingEnvironment.cs
- HttpRuntimeSection.cs
- ObjectTypeMapping.cs
- SafeFileMappingHandle.cs
- TextDecorationCollectionConverter.cs
- SafeCryptoHandles.cs
- AppDomainFactory.cs
- OrthographicCamera.cs
- LabelEditEvent.cs
- SafeMarshalContext.cs
- TreeNodeSelectionProcessor.cs
- AppDomainAttributes.cs
- FontCollection.cs
- AdjustableArrowCap.cs
- CookielessHelper.cs
- MembershipUser.cs
- CellCreator.cs
- DecoderBestFitFallback.cs
- Html32TextWriter.cs
- DescendantOverDescendantQuery.cs
- LinqDataSource.cs
- ScaleTransform.cs
- ScriptComponentDescriptor.cs
- DataKeyCollection.cs
- WindowsTooltip.cs
- TreePrinter.cs
- Stackframe.cs
- XmlAttributes.cs
- FixedDocument.cs
- _Events.cs
- ComponentCommands.cs
- CharacterMetrics.cs
- ServiceObjectContainer.cs
- QualifiedCellIdBoolean.cs
- Msec.cs
- ThreadPool.cs
- SuppressMessageAttribute.cs
- SqlDuplicator.cs
- SQLInt64.cs
- ControlDesigner.cs
- TraceContextRecord.cs
- LockCookie.cs
- SettingsSavedEventArgs.cs
- PointF.cs
- TypefaceCollection.cs
- Brush.cs
- OracleTimeSpan.cs
- DateTime.cs
- HttpApplicationStateBase.cs
- MenuItemStyleCollection.cs
- BulletedListEventArgs.cs
- NullRuntimeConfig.cs
- CompoundFileReference.cs
- GenericXmlSecurityToken.cs
- LineServices.cs
- EventEntry.cs
- ApplicationSettingsBase.cs
- TokenBasedSet.cs
- Opcode.cs
- NumberSubstitution.cs
- ListBox.cs
- Overlapped.cs
- LocatorManager.cs
- StatusCommandUI.cs
- SpeechSynthesizer.cs
- RemotingSurrogateSelector.cs
- TrackingAnnotationCollection.cs
- DataGridColumnHeader.cs
- TypeProvider.cs
- SystemColors.cs
- ObjectHandle.cs
- NotSupportedException.cs
- DoubleConverter.cs
- ButtonColumn.cs
- PrintSystemException.cs
- AnimatedTypeHelpers.cs
- CommandCollectionEditor.cs