Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Net / System / Net / Mail / AttachmentCollection.cs / 1 / 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. 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
- FileDialog.cs
- StringAnimationUsingKeyFrames.cs
- _DomainName.cs
- ErrorFormatterPage.cs
- InternalConfigEventArgs.cs
- ClientUrlResolverWrapper.cs
- EditorPartDesigner.cs
- WriteableOnDemandPackagePart.cs
- ApplySecurityAndSendAsyncResult.cs
- HttpRuntimeSection.cs
- DataListItem.cs
- RelationshipConstraintValidator.cs
- ConfigXmlElement.cs
- UIElementIsland.cs
- LocalClientSecuritySettings.cs
- DebugControllerThread.cs
- PolicyValidationException.cs
- StreamHelper.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- ToRequest.cs
- ApplicationGesture.cs
- AttachmentCollection.cs
- ValuePatternIdentifiers.cs
- RTLAwareMessageBox.cs
- WindowsScrollBarBits.cs
- x509utils.cs
- DataGridViewRowHeaderCell.cs
- MinimizableAttributeTypeConverter.cs
- PopOutPanel.cs
- UmAlQuraCalendar.cs
- PackagePart.cs
- MimeObjectFactory.cs
- BitStack.cs
- TTSEngineTypes.cs
- StylusTip.cs
- XmlWrappingReader.cs
- ToolStripSplitButton.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- MILUtilities.cs
- TextProperties.cs
- XmlQueryOutput.cs
- WsdlParser.cs
- RoleServiceManager.cs
- SmiSettersStream.cs
- PatternMatcher.cs
- BasePattern.cs
- newinstructionaction.cs
- ConnectionConsumerAttribute.cs
- CalloutQueueItem.cs
- XmlSequenceWriter.cs
- LinkUtilities.cs
- ListItemsPage.cs
- DataGridLengthConverter.cs
- RectangleHotSpot.cs
- ColorContextHelper.cs
- GenerateTemporaryAssemblyTask.cs
- ThreadNeutralSemaphore.cs
- PageParser.cs
- HtmlWindow.cs
- ChannelPool.cs
- BindingsSection.cs
- InfoCardCryptoHelper.cs
- RoleBoolean.cs
- TreeNodeBindingCollection.cs
- _UriSyntax.cs
- FrameworkRichTextComposition.cs
- EventSetter.cs
- FacetDescriptionElement.cs
- DispatcherFrame.cs
- XmlSchemaSimpleContent.cs
- PositiveTimeSpanValidatorAttribute.cs
- StretchValidation.cs
- DbConnectionOptions.cs
- TdsValueSetter.cs
- NamedObject.cs
- IdentityModelStringsVersion1.cs
- HandleExceptionArgs.cs
- DatatypeImplementation.cs
- XPathSelectionIterator.cs
- JpegBitmapEncoder.cs
- StopRoutingHandler.cs
- UserInitiatedNavigationPermission.cs
- SqlConnectionManager.cs
- MsmqBindingFilter.cs
- Identifier.cs
- Visual3D.cs
- PtsHelper.cs
- EntityTypeEmitter.cs
- DataGridViewMethods.cs
- PackagingUtilities.cs
- RIPEMD160Managed.cs
- ScaleTransform.cs
- TrustLevel.cs
- TypefaceCollection.cs
- DataFormats.cs
- MetadataArtifactLoaderCompositeFile.cs
- webeventbuffer.cs
- BuildManagerHost.cs
- HttpWriter.cs
- glyphs.cs