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
- SchemaSetCompiler.cs
- DesignerVerbCollection.cs
- Empty.cs
- OdbcDataReader.cs
- ViewGenerator.cs
- followingquery.cs
- HWStack.cs
- UserPreferenceChangingEventArgs.cs
- MsmqIntegrationBindingElement.cs
- HandlerFactoryWrapper.cs
- SoapSchemaImporter.cs
- SubpageParaClient.cs
- SQLSingleStorage.cs
- EditorPart.cs
- SqlClientWrapperSmiStreamChars.cs
- XamlInt32CollectionSerializer.cs
- FactoryRecord.cs
- ToolStripItemRenderEventArgs.cs
- CmsInterop.cs
- Setter.cs
- DropDownList.cs
- URLIdentityPermission.cs
- RSACryptoServiceProvider.cs
- DocumentGrid.cs
- MaskInputRejectedEventArgs.cs
- StrongNameSignatureInformation.cs
- NetworkInformationPermission.cs
- FilterException.cs
- XmlSchemaIdentityConstraint.cs
- FileDataSource.cs
- ThreadAttributes.cs
- Type.cs
- EntityDataSourceQueryBuilder.cs
- ConfigXmlCDataSection.cs
- HTMLTagNameToTypeMapper.cs
- EncoderExceptionFallback.cs
- StructuralObject.cs
- OracleConnection.cs
- Convert.cs
- UIHelper.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- PowerEase.cs
- TreeNodeCollection.cs
- CardSpaceSelector.cs
- OleDbInfoMessageEvent.cs
- PrinterResolution.cs
- XPathDescendantIterator.cs
- EditingCommands.cs
- ThreadPool.cs
- DataGridViewCellStyleConverter.cs
- EventLogPermission.cs
- CaseInsensitiveComparer.cs
- PhysicalAddress.cs
- ScrollItemProviderWrapper.cs
- InternalConfigRoot.cs
- Renderer.cs
- SchemaLookupTable.cs
- PersonalizationDictionary.cs
- FormsIdentity.cs
- PKCS1MaskGenerationMethod.cs
- BulletedListEventArgs.cs
- BaseCAMarshaler.cs
- COM2ComponentEditor.cs
- MessageEncodingBindingElementImporter.cs
- LazyTextWriterCreator.cs
- RegistrationContext.cs
- UIServiceHelper.cs
- AssemblyCollection.cs
- HashFinalRequest.cs
- Util.cs
- SoapIncludeAttribute.cs
- StateItem.cs
- XmlWhitespace.cs
- AnonymousIdentificationSection.cs
- RepeaterCommandEventArgs.cs
- OutputCacheModule.cs
- SchemaUtility.cs
- EnumBuilder.cs
- UInt16Storage.cs
- LogEntryDeserializer.cs
- RadioButton.cs
- ToggleButton.cs
- ChangeProcessor.cs
- DatatypeImplementation.cs
- InOutArgumentConverter.cs
- ValueHandle.cs
- XmlSchemaSimpleContentRestriction.cs
- OleStrCAMarshaler.cs
- TextTreeObjectNode.cs
- GridViewCellAutomationPeer.cs
- Separator.cs
- DictionaryGlobals.cs
- querybuilder.cs
- SelectionRangeConverter.cs
- DependencyPropertyChangedEventArgs.cs
- UseAttributeSetsAction.cs
- ServiceOperationListItemList.cs
- WebRequestModuleElement.cs
- WebServiceBindingAttribute.cs
- StrongName.cs