Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- KeysConverter.cs
- AncillaryOps.cs
- ValueType.cs
- DispatcherObject.cs
- Timer.cs
- FileAuthorizationModule.cs
- HtmlImage.cs
- SHA256Managed.cs
- DateTimeSerializationSection.cs
- Module.cs
- DataGridLength.cs
- _HeaderInfoTable.cs
- ProcessModelInfo.cs
- SynchronizedCollection.cs
- BCLDebug.cs
- AppDomainProtocolHandler.cs
- _SslStream.cs
- _ScatterGatherBuffers.cs
- XpsSerializationManager.cs
- EntityKeyElement.cs
- DesignerVerb.cs
- AssemblySettingAttributes.cs
- CreateUserWizardDesigner.cs
- SoapAttributeAttribute.cs
- HtmlInputText.cs
- CapabilitiesState.cs
- TextCollapsingProperties.cs
- ElementAction.cs
- Pkcs7Signer.cs
- CodeAccessSecurityEngine.cs
- HttpContext.cs
- ExecutionEngineException.cs
- ReadOnlyDataSourceView.cs
- DataGridViewCellCancelEventArgs.cs
- ViewBase.cs
- StylusShape.cs
- ValueHandle.cs
- WebSysDefaultValueAttribute.cs
- ToolStripItemClickedEventArgs.cs
- X509Certificate.cs
- AppModelKnownContentFactory.cs
- GeneralTransform3DGroup.cs
- CompositeFontParser.cs
- HttpVersion.cs
- LogLogRecord.cs
- CodeSnippetTypeMember.cs
- PageClientProxyGenerator.cs
- Semaphore.cs
- DefaultPrintController.cs
- BinaryFormatterSinks.cs
- EventTrigger.cs
- ActivityExecutor.cs
- Membership.cs
- UserControlCodeDomTreeGenerator.cs
- MenuItemStyle.cs
- IItemContainerGenerator.cs
- JournalEntry.cs
- _OSSOCK.cs
- KeyTime.cs
- ResourceReferenceExpression.cs
- CoreSwitches.cs
- UntrustedRecipientException.cs
- PrivilegeNotHeldException.cs
- TagPrefixInfo.cs
- BrowserTree.cs
- XmlSchemaSimpleTypeList.cs
- HelpEvent.cs
- StandardBindingOptionalReliableSessionElement.cs
- RootBrowserWindowProxy.cs
- CustomTypeDescriptor.cs
- XmlSchemaGroupRef.cs
- UrlPath.cs
- Grant.cs
- DocumentEventArgs.cs
- XmlSchemas.cs
- PassportIdentity.cs
- MobileControl.cs
- TextEditor.cs
- NeutralResourcesLanguageAttribute.cs
- XmlBaseWriter.cs
- RectKeyFrameCollection.cs
- XmlComplianceUtil.cs
- TextSelectionProcessor.cs
- AppModelKnownContentFactory.cs
- InvalidOleVariantTypeException.cs
- CustomErrorsSectionWrapper.cs
- FormViewUpdateEventArgs.cs
- ConstraintCollection.cs
- SqlBulkCopyColumnMappingCollection.cs
- DotExpr.cs
- RepeaterCommandEventArgs.cs
- SafeNativeMethods.cs
- IImplicitResourceProvider.cs
- PersonalizationAdministration.cs
- ReadOnlyDataSource.cs
- DrawingDrawingContext.cs
- Random.cs
- WorkflowViewStateService.cs
- ObjectManager.cs
- MatrixTransform.cs