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
- MsmqBindingFilter.cs
- GeometryCollection.cs
- HttpCachePolicyBase.cs
- SendMailErrorEventArgs.cs
- ToolStripComboBox.cs
- MenuBase.cs
- MailDefinition.cs
- StyleCollection.cs
- OdbcErrorCollection.cs
- TableRowGroup.cs
- EntityClassGenerator.cs
- HttpRuntimeSection.cs
- XmlDataProvider.cs
- ForeignConstraint.cs
- X509Utils.cs
- FixedPage.cs
- XmlSchemaCompilationSettings.cs
- LongValidatorAttribute.cs
- RegionData.cs
- MetadataProperty.cs
- PackWebRequestFactory.cs
- ShortcutKeysEditor.cs
- DataTableNameHandler.cs
- BamlResourceDeserializer.cs
- WSDualHttpSecurityMode.cs
- SqlDataSourceDesigner.cs
- OleDbFactory.cs
- PasswordBox.cs
- SqlInternalConnectionTds.cs
- FilterElement.cs
- TrackingServices.cs
- Iis7Helper.cs
- PersonalizableTypeEntry.cs
- PersistenceTypeAttribute.cs
- SrgsToken.cs
- Vector3dCollection.cs
- ToolStripSeparator.cs
- TypeForwardedToAttribute.cs
- TextSelectionHelper.cs
- Context.cs
- DefaultValueAttribute.cs
- GatewayDefinition.cs
- SchemaInfo.cs
- DbDataSourceEnumerator.cs
- RequestResizeEvent.cs
- ElementProxy.cs
- CompositeKey.cs
- FocusChangedEventArgs.cs
- VectorCollectionConverter.cs
- CanonicalXml.cs
- DataPager.cs
- ImageIndexConverter.cs
- WindowsPrincipal.cs
- WorkItem.cs
- XPathNavigatorReader.cs
- JsonStringDataContract.cs
- StringDictionary.cs
- SqlInternalConnectionTds.cs
- MDIClient.cs
- regiisutil.cs
- SmtpReplyReaderFactory.cs
- HttpRuntime.cs
- XmlBinaryReader.cs
- FileDataSource.cs
- BuildManager.cs
- ScriptRef.cs
- CornerRadiusConverter.cs
- ColorDialog.cs
- SystemBrushes.cs
- DemultiplexingClientMessageFormatter.cs
- HtmlFormParameterReader.cs
- HtmlPhoneCallAdapter.cs
- DataGridCell.cs
- ConfigurationElementProperty.cs
- WorkflowServiceHostFactory.cs
- ArrangedElement.cs
- PolyLineSegment.cs
- TypeSource.cs
- Image.cs
- CallContext.cs
- ImageSource.cs
- XPathDescendantIterator.cs
- ContainerAction.cs
- DataContractSerializerMessageContractImporter.cs
- PtsPage.cs
- SurrogateSelector.cs
- WebPartTransformer.cs
- OracleRowUpdatedEventArgs.cs
- EntityDesignerUtils.cs
- InstallerTypeAttribute.cs
- LabelLiteral.cs
- RC2CryptoServiceProvider.cs
- WindowsScrollBar.cs
- UIElement3D.cs
- XPathNodeInfoAtom.cs
- TextElementCollection.cs
- RtfNavigator.cs
- PrintPreviewControl.cs
- Emitter.cs
- PropertyEmitter.cs