Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Mail / AttachmentCollection.cs / 1305376 / AttachmentCollection.cs
using System; using System.Collections.ObjectModel; namespace System.Net.Mail { ////// Summary description for AttachmentCollection. /// public sealed class AttachmentCollection : Collection, IDisposable { bool disposed = false; internal AttachmentCollection() { } public void Dispose(){ if(disposed){ return; } foreach (Attachment attachment in this) { attachment.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, Attachment 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, Attachment 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
- URLString.cs
- ToolTip.cs
- Lookup.cs
- DbDataSourceEnumerator.cs
- SelectiveScrollingGrid.cs
- EventPropertyMap.cs
- AnonymousIdentificationModule.cs
- IMembershipProvider.cs
- VectorAnimationUsingKeyFrames.cs
- UIElementParagraph.cs
- ContentWrapperAttribute.cs
- IssuanceLicense.cs
- DefaultSection.cs
- DirectoryNotFoundException.cs
- SimplePropertyEntry.cs
- QueryOptionExpression.cs
- IntellisenseTextBox.cs
- ToolStripDropDownButton.cs
- SqlClientPermission.cs
- XamlFigureLengthSerializer.cs
- RenderingEventArgs.cs
- RemoteWebConfigurationHost.cs
- ListViewItemCollectionEditor.cs
- EditorPartCollection.cs
- TabControlEvent.cs
- TypeNameConverter.cs
- LinqDataSourceView.cs
- CredentialCache.cs
- CustomAttributeBuilder.cs
- EmptyStringExpandableObjectConverter.cs
- ProtocolProfile.cs
- TextTreeText.cs
- StringValueSerializer.cs
- PagerSettings.cs
- XmlExceptionHelper.cs
- ProxyGenerationError.cs
- SafeSecurityHelper.cs
- TextPenaltyModule.cs
- Resources.Designer.cs
- MessageDesigner.cs
- XmlParserContext.cs
- ControlCachePolicy.cs
- Visual3D.cs
- TakeQueryOptionExpression.cs
- DataGridViewRowCollection.cs
- ContentPosition.cs
- XmlMemberMapping.cs
- StringAttributeCollection.cs
- XsltContext.cs
- ObjectDataSourceEventArgs.cs
- LocatorPart.cs
- DataGridColumnCollection.cs
- MsdtcWrapper.cs
- Attributes.cs
- SerializerProvider.cs
- DecimalMinMaxAggregationOperator.cs
- TransportBindingElementImporter.cs
- PrivilegeNotHeldException.cs
- Timeline.cs
- CircleHotSpot.cs
- SHA512CryptoServiceProvider.cs
- UndirectedGraph.cs
- Event.cs
- HostElement.cs
- TextTrailingCharacterEllipsis.cs
- Vector3dCollection.cs
- Version.cs
- EntityDesignerUtils.cs
- TemplateBuilder.cs
- StatusStrip.cs
- DynamicFilterExpression.cs
- Size.cs
- MenuBase.cs
- CustomPopupPlacement.cs
- WebConfigurationManager.cs
- MessagePartSpecification.cs
- ClientCultureInfo.cs
- UnmanagedMemoryStream.cs
- GradientStopCollection.cs
- infer.cs
- DataGridParentRows.cs
- XmlTextWriter.cs
- _HTTPDateParse.cs
- XmlValidatingReaderImpl.cs
- ChangeToolStripParentVerb.cs
- EntityClassGenerator.cs
- CellPartitioner.cs
- SqlWebEventProvider.cs
- PerfCounters.cs
- ProgressBarBrushConverter.cs
- WinFormsComponentEditor.cs
- TraceListeners.cs
- DataControlFieldHeaderCell.cs
- DataGridViewRowCancelEventArgs.cs
- XLinq.cs
- TreeWalkHelper.cs
- UIElementAutomationPeer.cs
- CollectionChangedEventManager.cs
- CompositeCollection.cs
- TrackingServices.cs