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
- NativeCompoundFileAPIs.cs
- DeviceContexts.cs
- EntityKey.cs
- RevocationPoint.cs
- TextRenderingModeValidation.cs
- XmlSchemaSimpleContent.cs
- ZipIOExtraFieldElement.cs
- DataRecordInternal.cs
- GenericUI.cs
- SessionState.cs
- RIPEMD160Managed.cs
- ManualResetEvent.cs
- GacUtil.cs
- NativeMethods.cs
- MonitorWrapper.cs
- PersonalizationEntry.cs
- AccessedThroughPropertyAttribute.cs
- SetterBaseCollection.cs
- HttpHandlerActionCollection.cs
- ParseHttpDate.cs
- CompressEmulationStream.cs
- DeleteWorkflowOwnerCommand.cs
- SiteOfOriginPart.cs
- ProviderException.cs
- RichTextBox.cs
- IsolatedStorageSecurityState.cs
- ActivityWithResultValueSerializer.cs
- PersonalizationStateQuery.cs
- Model3D.cs
- HtmlTextArea.cs
- DataRelation.cs
- DefaultAutoFieldGenerator.cs
- SizeLimitedCache.cs
- NotificationContext.cs
- UIElementPropertyUndoUnit.cs
- XmlQueryOutput.cs
- GregorianCalendar.cs
- OdbcEnvironment.cs
- COM2ExtendedTypeConverter.cs
- UnionCqlBlock.cs
- SortDescriptionCollection.cs
- FloaterBaseParaClient.cs
- AgileSafeNativeMemoryHandle.cs
- TraceHandlerErrorFormatter.cs
- KerberosReceiverSecurityToken.cs
- NumberFormatInfo.cs
- HandlerWithFactory.cs
- Constants.cs
- DataGridViewDataErrorEventArgs.cs
- PageBuildProvider.cs
- SqlDataReaderSmi.cs
- UnhandledExceptionEventArgs.cs
- DbDataRecord.cs
- WinEventWrap.cs
- Signature.cs
- XmlSchemaInclude.cs
- SQLStringStorage.cs
- WaitHandleCannotBeOpenedException.cs
- StickyNote.cs
- DataPagerField.cs
- CodeCatchClauseCollection.cs
- Int16Storage.cs
- RectIndependentAnimationStorage.cs
- SmtpCommands.cs
- WeakReference.cs
- MdiWindowListStrip.cs
- FontStyleConverter.cs
- DataServiceBuildProvider.cs
- ToolboxItemLoader.cs
- ViewStateModeByIdAttribute.cs
- PropertyChangedEventManager.cs
- QilParameter.cs
- sqlinternaltransaction.cs
- LinkButton.cs
- ReferencedAssemblyResolver.cs
- XmlDomTextWriter.cs
- LinqDataSourceHelper.cs
- InplaceBitmapMetadataWriter.cs
- GuidConverter.cs
- SchemaObjectWriter.cs
- FormsAuthenticationUserCollection.cs
- CollectionViewGroup.cs
- StandardToolWindows.cs
- SingleStorage.cs
- FileUpload.cs
- ExtendedPropertiesHandler.cs
- PersonalizationState.cs
- WebPartTracker.cs
- ContentDisposition.cs
- CommandHelpers.cs
- TrackingLocationCollection.cs
- SoapCodeExporter.cs
- EpmCustomContentSerializer.cs
- CmsInterop.cs
- TimeStampChecker.cs
- HotSpot.cs
- PopupRoot.cs
- Action.cs
- ResXDataNode.cs
- WindowsListViewItemCheckBox.cs