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
- ObjectCloneHelper.cs
- XmlSchemaSimpleTypeUnion.cs
- ColumnReorderedEventArgs.cs
- ParserContext.cs
- ClientRolePrincipal.cs
- ToolStripStatusLabel.cs
- SystemWebExtensionsSectionGroup.cs
- DataReaderContainer.cs
- ResourceReferenceExpression.cs
- XXXOnTypeBuilderInstantiation.cs
- DesignSurface.cs
- DataBindingCollection.cs
- XmlNamespaceDeclarationsAttribute.cs
- ScriptControl.cs
- PrintEvent.cs
- SQLGuid.cs
- HtmlControl.cs
- DockPatternIdentifiers.cs
- XmlAnyAttributeAttribute.cs
- CornerRadiusConverter.cs
- FamilyTypefaceCollection.cs
- ShapingWorkspace.cs
- Localizer.cs
- PrintEvent.cs
- XmlComment.cs
- SchemaHelper.cs
- UnsafeCollabNativeMethods.cs
- X509Certificate2Collection.cs
- ConfigurationStrings.cs
- XPathMultyIterator.cs
- DirectionalLight.cs
- ManagementEventArgs.cs
- CompilerGlobalScopeAttribute.cs
- CodeGen.cs
- NonBatchDirectoryCompiler.cs
- TimelineGroup.cs
- TableLayoutRowStyleCollection.cs
- EmptyStringExpandableObjectConverter.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- Descriptor.cs
- DrawingState.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- CompilerWrapper.cs
- AsmxEndpointPickerExtension.cs
- AbandonedMutexException.cs
- DEREncoding.cs
- wmiprovider.cs
- XmlUTF8TextReader.cs
- MailFileEditor.cs
- FlowLayoutSettings.cs
- SqlDataReader.cs
- HMACSHA256.cs
- NativeMethods.cs
- UpdateException.cs
- WebBaseEventKeyComparer.cs
- SmtpFailedRecipientsException.cs
- SspiSecurityTokenProvider.cs
- StringUtil.cs
- wmiprovider.cs
- complextypematerializer.cs
- RMEnrollmentPage2.cs
- ColumnHeaderCollectionEditor.cs
- HwndKeyboardInputProvider.cs
- SqlMethodTransformer.cs
- InstanceDescriptor.cs
- WindowProviderWrapper.cs
- PickBranch.cs
- LocalIdKeyIdentifierClause.cs
- StackOverflowException.cs
- DynamicObject.cs
- PolyLineSegment.cs
- AspNetHostingPermission.cs
- Viewport2DVisual3D.cs
- EncoderParameter.cs
- TrustSection.cs
- Pair.cs
- KeyToListMap.cs
- ParenExpr.cs
- ElementsClipboardData.cs
- MissingMethodException.cs
- PackageDigitalSignatureManager.cs
- IdnElement.cs
- TextPointerBase.cs
- ImagingCache.cs
- ServiceReflector.cs
- SoapProtocolImporter.cs
- DrawingAttributesDefaultValueFactory.cs
- XmlAutoDetectWriter.cs
- RectConverter.cs
- ToolStripPanelCell.cs
- AuthenticationSection.cs
- NamedObject.cs
- XmlNodeChangedEventArgs.cs
- RawContentTypeMapper.cs
- DesignerDataConnection.cs
- DeviceSpecificDialogCachedState.cs
- DesignerAdRotatorAdapter.cs
- LogRecordSequence.cs
- SymbolMethod.cs
- NativeMethods.cs