Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- DocumentScope.cs
- DispatcherSynchronizationContext.cs
- SafeNativeMethods.cs
- recordstate.cs
- IriParsingElement.cs
- COM2TypeInfoProcessor.cs
- OpenFileDialog.cs
- KerberosRequestorSecurityToken.cs
- ItemList.cs
- LineServicesCallbacks.cs
- TraceContext.cs
- BezierSegment.cs
- InfocardChannelParameter.cs
- TemplatingOptionsDialog.cs
- CodeCompileUnit.cs
- CodeBlockBuilder.cs
- StreamGeometryContext.cs
- KnownBoxes.cs
- DefaultAsyncDataDispatcher.cs
- Listen.cs
- SimpleBitVector32.cs
- RegistryKey.cs
- CodeLabeledStatement.cs
- XhtmlBasicListAdapter.cs
- TimersDescriptionAttribute.cs
- ToolStripPanel.cs
- FixedTextContainer.cs
- HotSpotCollection.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- EditorZoneDesigner.cs
- BindingExpressionBase.cs
- ListViewCommandEventArgs.cs
- MatrixCamera.cs
- XamlSerializationHelper.cs
- SubclassTypeValidatorAttribute.cs
- HtmlCalendarAdapter.cs
- EasingKeyFrames.cs
- OrderByQueryOptionExpression.cs
- ToolStripRendererSwitcher.cs
- Stacktrace.cs
- XmlWriterSettings.cs
- UpdateException.cs
- TypeToStringValueConverter.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- IdleTimeoutMonitor.cs
- ConnectionPoolManager.cs
- CommonXSendMessage.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- BitmapFrame.cs
- PeerNodeTraceRecord.cs
- TraceInternal.cs
- PointCollection.cs
- ProcessModule.cs
- EntityContainerRelationshipSet.cs
- OracleBoolean.cs
- GridViewCancelEditEventArgs.cs
- SystemIPInterfaceStatistics.cs
- XmlReader.cs
- RequestResizeEvent.cs
- SimplePropertyEntry.cs
- DataGridHeaderBorder.cs
- ConsoleCancelEventArgs.cs
- TimelineGroup.cs
- BackgroundWorker.cs
- RowType.cs
- ControlBuilder.cs
- CapabilitiesAssignment.cs
- XamlFigureLengthSerializer.cs
- NamedPipeWorkerProcess.cs
- WindowsPen.cs
- DefinitionBase.cs
- TimeoutException.cs
- Empty.cs
- AddInActivator.cs
- printdlgexmarshaler.cs
- MergeLocalizationDirectives.cs
- Substitution.cs
- SafeNativeMethods.cs
- DiscoveryReferences.cs
- TypeConstant.cs
- WebPartConnectionsDisconnectVerb.cs
- X509Chain.cs
- OleDbTransaction.cs
- RepeatButtonAutomationPeer.cs
- SystemDropShadowChrome.cs
- WindowsPen.cs
- SQLInt32.cs
- StructuredTypeEmitter.cs
- IChannel.cs
- WebPartDisplayMode.cs
- SymmetricKeyWrap.cs
- XmlnsDefinitionAttribute.cs
- Rect3DConverter.cs
- MobileCategoryAttribute.cs
- QilFactory.cs
- PropertyInformationCollection.cs
- XmlSchemaComplexContentExtension.cs
- SiteMap.cs
- ItemDragEvent.cs
- MarkedHighlightComponent.cs