Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / Mail / LinkedResourceCollection.cs / 1 / LinkedResourceCollection.cs
using System; using System.Collections.ObjectModel; namespace System.Net.Mail { public sealed class LinkedResourceCollection : Collection, IDisposable { bool disposed = false; internal LinkedResourceCollection() { } public void Dispose() { if(disposed){ return; } foreach (LinkedResource resource in this) { resource.Dispose(); } Clear(); disposed = true; } protected override void RemoveItem(int index){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } base.RemoveItem(index); } protected override void ClearItems(){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } base.ClearItems(); } protected override void SetItem(int index, LinkedResource item){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } if(item==null) { throw new ArgumentNullException("item"); } base.SetItem(index,item); } protected override void InsertItem(int index, LinkedResource item){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } if(item==null){ throw new ArgumentNullException("item"); } base.InsertItem(index,item); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.ObjectModel; namespace System.Net.Mail { public sealed class LinkedResourceCollection : Collection , IDisposable { bool disposed = false; internal LinkedResourceCollection() { } public void Dispose() { if(disposed){ return; } foreach (LinkedResource resource in this) { resource.Dispose(); } Clear(); disposed = true; } protected override void RemoveItem(int index){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } base.RemoveItem(index); } protected override void ClearItems(){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } base.ClearItems(); } protected override void SetItem(int index, LinkedResource item){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } if(item==null) { throw new ArgumentNullException("item"); } base.SetItem(index,item); } protected override void InsertItem(int index, LinkedResource item){ if (disposed) { throw new ObjectDisposedException(this.GetType().FullName); } if(item==null){ throw new ArgumentNullException("item"); } base.InsertItem(index,item); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PixelFormat.cs
- XmlSchemaSimpleType.cs
- BitmapCodecInfoInternal.cs
- documentation.cs
- MaskInputRejectedEventArgs.cs
- ExpressionContext.cs
- RuntimeCompatibilityAttribute.cs
- AutomationEventArgs.cs
- StorageTypeMapping.cs
- AttributedMetaModel.cs
- DoubleCollectionConverter.cs
- _SslStream.cs
- DeferredRunTextReference.cs
- ChildChangedEventArgs.cs
- IPEndPoint.cs
- BindingWorker.cs
- SqlHelper.cs
- InstanceCreationEditor.cs
- DataGridSortCommandEventArgs.cs
- RewritingProcessor.cs
- XmlUnspecifiedAttribute.cs
- Mappings.cs
- HideDisabledControlAdapter.cs
- PersistencePipeline.cs
- CompressStream.cs
- XPathNodeList.cs
- NativeMethods.cs
- PathFigure.cs
- TextCompositionEventArgs.cs
- TrackingLocationCollection.cs
- XmlUrlResolver.cs
- AnimationException.cs
- XDRSchema.cs
- EventToken.cs
- Message.cs
- Propagator.ExtentPlaceholderCreator.cs
- VerticalAlignConverter.cs
- WorkflowElementDialog.cs
- PropertyNames.cs
- TreeViewImageIndexConverter.cs
- WebServiceEnumData.cs
- ClientRuntimeConfig.cs
- PartitionResolver.cs
- XmlSignificantWhitespace.cs
- ItemsControlAutomationPeer.cs
- TemplateManager.cs
- WsatConfiguration.cs
- CounterSampleCalculator.cs
- Missing.cs
- Scalars.cs
- FormViewActionList.cs
- WinFormsUtils.cs
- SqlDataReaderSmi.cs
- XmlQueryRuntime.cs
- WebPartTracker.cs
- XmlDictionaryString.cs
- XmlSchemaCompilationSettings.cs
- XpsManager.cs
- WindowsNonControl.cs
- DateTimeConverter2.cs
- XmlSchemaCompilationSettings.cs
- ConfigurationProperty.cs
- DebugView.cs
- InfoCardTrace.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- StringArrayConverter.cs
- DocumentEventArgs.cs
- NativeMethodsCLR.cs
- Vector3D.cs
- ProfileModule.cs
- HttpResponseInternalWrapper.cs
- EntityDataSourceChangingEventArgs.cs
- AbstractExpressions.cs
- ReferencedCollectionType.cs
- SQLStringStorage.cs
- HtmlInputControl.cs
- TemplateBaseAction.cs
- SafeViewOfFileHandle.cs
- GridViewItemAutomationPeer.cs
- ParameterCollection.cs
- TogglePattern.cs
- DateTimeOffsetConverter.cs
- SettingsBase.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- sqlser.cs
- ConsumerConnectionPoint.cs
- EncoderBestFitFallback.cs
- Propagator.cs
- DataObjectPastingEventArgs.cs
- PackWebResponse.cs
- QilDataSource.cs
- StreamWithDictionary.cs
- ColumnCollection.cs
- TextCharacters.cs
- BlobPersonalizationState.cs
- diagnosticsswitches.cs
- MouseEventArgs.cs
- ThicknessAnimation.cs
- UnsupportedPolicyOptionsException.cs
- RemotingSurrogateSelector.cs