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
- SiteMapDataSourceView.cs
- GeneratedContractType.cs
- QueryOperationResponseOfT.cs
- KoreanCalendar.cs
- ExponentialEase.cs
- ParameterToken.cs
- StreamGeometry.cs
- TextEncodedRawTextWriter.cs
- RuleSettingsCollection.cs
- MenuCommand.cs
- ColumnResult.cs
- Point3DValueSerializer.cs
- RtfNavigator.cs
- Inline.cs
- OdbcConnectionFactory.cs
- DataContractJsonSerializerOperationFormatter.cs
- WsdlEndpointConversionContext.cs
- ConfigurationSection.cs
- RemotingAttributes.cs
- OleDbRowUpdatedEvent.cs
- BaseCodePageEncoding.cs
- PanelDesigner.cs
- XmlSchemaInferenceException.cs
- DockProviderWrapper.cs
- ConvertEvent.cs
- PrintDialog.cs
- Rijndael.cs
- OutputCacheSettingsSection.cs
- DetailsViewDeleteEventArgs.cs
- ReliabilityContractAttribute.cs
- TextEditorSelection.cs
- MissingMethodException.cs
- Themes.cs
- TreeNodeBindingCollection.cs
- ControlBuilder.cs
- ScriptManager.cs
- TransactionChannelFaultConverter.cs
- SmtpSection.cs
- SchemaImporterExtension.cs
- RouteParser.cs
- EntitySetRetriever.cs
- XmlHierarchyData.cs
- DataBindingList.cs
- CallbackValidator.cs
- SafeHandles.cs
- HwndHost.cs
- DataGridViewCheckBoxCell.cs
- TextWriter.cs
- GridPatternIdentifiers.cs
- MethodBuilder.cs
- OptionalColumn.cs
- SortedList.cs
- BaseTemplateBuildProvider.cs
- LicFileLicenseProvider.cs
- LightweightCodeGenerator.cs
- WrappingXamlSchemaContext.cs
- DocumentDesigner.cs
- AncillaryOps.cs
- BuilderElements.cs
- XamlPoint3DCollectionSerializer.cs
- RecordsAffectedEventArgs.cs
- ListItem.cs
- EdmItemError.cs
- QualifiedCellIdBoolean.cs
- RichTextBox.cs
- _SSPISessionCache.cs
- codemethodreferenceexpression.cs
- PropertyDescriptor.cs
- WebDisplayNameAttribute.cs
- ObjectDataSourceEventArgs.cs
- ProfileBuildProvider.cs
- ListViewItemMouseHoverEvent.cs
- ExpressionBindingCollection.cs
- ArgumentNullException.cs
- Int64AnimationUsingKeyFrames.cs
- RegexCaptureCollection.cs
- DataSetMappper.cs
- SiteMapNodeCollection.cs
- MetadataArtifactLoaderFile.cs
- Array.cs
- CryptoConfig.cs
- ObjectRef.cs
- InvalidTimeZoneException.cs
- DiscoveryMessageSequenceGenerator.cs
- BlurBitmapEffect.cs
- MasterPage.cs
- ManualResetEvent.cs
- WindowsListBox.cs
- StoreItemCollection.Loader.cs
- _AutoWebProxyScriptEngine.cs
- XmlSchemaObjectCollection.cs
- TextDecorationLocationValidation.cs
- StateChangeEvent.cs
- SEHException.cs
- AppDomainEvidenceFactory.cs
- FullTrustAssembly.cs
- TextRunCache.cs
- CoTaskMemHandle.cs
- XmlSchemaSequence.cs
- WebPartActionVerb.cs