Code:
/ FX-1434 / FX-1434 / 1.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
- CommandConverter.cs
- TextAction.cs
- AspNetRouteServiceHttpHandler.cs
- SiteIdentityPermission.cs
- SqlClientWrapperSmiStream.cs
- SponsorHelper.cs
- DecoderNLS.cs
- CultureNotFoundException.cs
- IncomingWebResponseContext.cs
- AddInContractAttribute.cs
- ValidationErrorCollection.cs
- CalendarTable.cs
- PeerName.cs
- SiteIdentityPermission.cs
- Int64KeyFrameCollection.cs
- OracleDateTime.cs
- __Error.cs
- XmlAnyAttributeAttribute.cs
- HatchBrush.cs
- XmlSchemaAll.cs
- MatrixUtil.cs
- CodeAccessPermission.cs
- SchemaHelper.cs
- SiteMap.cs
- DataContractSerializerMessageContractImporter.cs
- HotSpotCollectionEditor.cs
- HtmlTableRow.cs
- Wow64ConfigurationLoader.cs
- SQLByte.cs
- LogRecordSequence.cs
- BufferedReadStream.cs
- ArrayConverter.cs
- Calendar.cs
- PrinterResolution.cs
- UseAttributeSetsAction.cs
- ContentControl.cs
- ViewLoader.cs
- SplitterCancelEvent.cs
- Aggregates.cs
- NestedContainer.cs
- BaseValidator.cs
- InkPresenterAutomationPeer.cs
- Literal.cs
- ToolboxItemFilterAttribute.cs
- DbConnectionPoolOptions.cs
- Size.cs
- _NestedSingleAsyncResult.cs
- CurrentChangingEventArgs.cs
- LicenseContext.cs
- State.cs
- NoneExcludedImageIndexConverter.cs
- SvcFileManager.cs
- ProfileGroupSettings.cs
- SemaphoreSecurity.cs
- HttpSessionStateWrapper.cs
- DrawToolTipEventArgs.cs
- connectionpool.cs
- InternalTransaction.cs
- WebConfigurationHost.cs
- ThreadPool.cs
- HtmlTextArea.cs
- CommandField.cs
- CompiledELinqQueryState.cs
- CommandValueSerializer.cs
- PathFigureCollection.cs
- XmlNode.cs
- JsonReaderDelegator.cs
- XmlConvert.cs
- listitem.cs
- LoginViewDesigner.cs
- ECDiffieHellman.cs
- ColorConvertedBitmap.cs
- Visual3D.cs
- FormViewRow.cs
- SymbolType.cs
- HttpModule.cs
- DataGridCellItemAutomationPeer.cs
- ContractHandle.cs
- PartialCachingAttribute.cs
- DelimitedListTraceListener.cs
- BaseTemplateParser.cs
- ProfileManager.cs
- SimpleType.cs
- HwndHost.cs
- DelegateArgumentValue.cs
- TransformPattern.cs
- DataViewSetting.cs
- DocumentOrderComparer.cs
- Command.cs
- TypeSource.cs
- hebrewshape.cs
- CollectionChangeEventArgs.cs
- BindingList.cs
- Merger.cs
- RegistryPermission.cs
- GlobalEventManager.cs
- CodeTryCatchFinallyStatement.cs
- SharedDp.cs
- pingexception.cs
- DragEvent.cs