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
- CopyNamespacesAction.cs
- SpotLight.cs
- GlyphCollection.cs
- LifetimeServices.cs
- InvalidAsynchronousStateException.cs
- EntityException.cs
- SslStream.cs
- DetailsViewModeEventArgs.cs
- _UncName.cs
- IProvider.cs
- UIAgentMonitorHandle.cs
- SiteMapNodeCollection.cs
- WinInet.cs
- DeviceContext.cs
- WindowsScroll.cs
- SchemaMerger.cs
- BaseParagraph.cs
- XPathItem.cs
- ProfileGroupSettingsCollection.cs
- ProfileManager.cs
- SuppressMessageAttribute.cs
- XmlSchemaAnnotation.cs
- FontInfo.cs
- HtmlTableCellCollection.cs
- DeviceContexts.cs
- AttributeProviderAttribute.cs
- ApplyImportsAction.cs
- ProcessHostConfigUtils.cs
- ScaleTransform.cs
- Line.cs
- EntityDataSourceWizardForm.cs
- EnumerationRangeValidationUtil.cs
- CombinedHttpChannel.cs
- PointUtil.cs
- References.cs
- LockedBorderGlyph.cs
- PolicyException.cs
- ObjectListGeneralPage.cs
- PackageRelationshipCollection.cs
- Group.cs
- DrawListViewSubItemEventArgs.cs
- TemplateNodeContextMenu.cs
- GPStream.cs
- CompositeControl.cs
- ValidatingCollection.cs
- HatchBrush.cs
- DesignerGeometryHelper.cs
- CodeAccessPermission.cs
- BrushConverter.cs
- SafeRightsManagementQueryHandle.cs
- XmlSchemaSimpleContentRestriction.cs
- EntityDataSourceReferenceGroup.cs
- XmlQueryRuntime.cs
- SemanticResultKey.cs
- UInt64Storage.cs
- SrgsGrammarCompiler.cs
- TransformDescriptor.cs
- SqlFunctionAttribute.cs
- DbDeleteCommandTree.cs
- GeneratedView.cs
- ProvidePropertyAttribute.cs
- Globals.cs
- WrappedIUnknown.cs
- TemplateNodeContextMenu.cs
- ModelTreeManager.cs
- EmptyEnumerable.cs
- TableRow.cs
- GlyphRun.cs
- RenderTargetBitmap.cs
- ReflectTypeDescriptionProvider.cs
- SubMenuStyleCollection.cs
- EventSetterHandlerConverter.cs
- Constants.cs
- DispatcherObject.cs
- MessageHeaderAttribute.cs
- SQLInt32Storage.cs
- Point3DCollectionValueSerializer.cs
- DemultiplexingDispatchMessageFormatter.cs
- ISAPIRuntime.cs
- StringReader.cs
- XmlSchemaImporter.cs
- InternalConfigHost.cs
- DBCommand.cs
- QueryOperator.cs
- CompensateDesigner.cs
- XmlTextEncoder.cs
- Axis.cs
- RegistrationServices.cs
- FrameworkRichTextComposition.cs
- ImageSource.cs
- MemoryMappedFile.cs
- BaseWebProxyFinder.cs
- RepeaterCommandEventArgs.cs
- EmptyStringExpandableObjectConverter.cs
- DefaultConfirmation.cs
- SpoolingTask.cs
- ConstantCheck.cs
- ParserExtension.cs
- PartialCachingControl.cs
- KnownTypes.cs