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
- CodeEntryPointMethod.cs
- PrintingPermission.cs
- TcpProcessProtocolHandler.cs
- ScrollEvent.cs
- XmlArrayItemAttribute.cs
- XmlNavigatorStack.cs
- ListManagerBindingsCollection.cs
- EventManager.cs
- MemberDescriptor.cs
- SqlVersion.cs
- FutureFactory.cs
- HttpSocketManager.cs
- UnsafeNativeMethods.cs
- brushes.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- ProtectedConfigurationSection.cs
- CannotUnloadAppDomainException.cs
- DialogResultConverter.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- GPRECTF.cs
- TextSelection.cs
- ExpressionVisitor.cs
- RoleGroupCollection.cs
- Deflater.cs
- StaticSiteMapProvider.cs
- KeyedCollection.cs
- TextTreeUndo.cs
- TraceLevelStore.cs
- DispatcherExceptionFilterEventArgs.cs
- UnsafePeerToPeerMethods.cs
- CountdownEvent.cs
- Parsers.cs
- DataListItem.cs
- DomNameTable.cs
- DBNull.cs
- VerticalAlignConverter.cs
- IsolatedStoragePermission.cs
- ListenerPerfCounters.cs
- BooleanKeyFrameCollection.cs
- MethodImplAttribute.cs
- GridViewRowPresenter.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- CompilerError.cs
- WebScriptMetadataFormatter.cs
- SafeCryptContextHandle.cs
- OracleNumber.cs
- HandlerFactoryWrapper.cs
- FontWeights.cs
- TextTreeFixupNode.cs
- QueryStack.cs
- DirectionalLight.cs
- EntityDataSourceChangedEventArgs.cs
- WinFormsComponentEditor.cs
- ComponentConverter.cs
- BaseCodeDomTreeGenerator.cs
- SHA512Managed.cs
- ContourSegment.cs
- MappingItemCollection.cs
- HttpRequestCacheValidator.cs
- DesignerView.Commands.cs
- MissingFieldException.cs
- TCPClient.cs
- FrameworkElementFactory.cs
- SoapMessage.cs
- PerformanceCounters.cs
- StandardCommands.cs
- AttributeInfo.cs
- SqlTopReducer.cs
- TableLayoutPanelBehavior.cs
- ActivityWithResultConverter.cs
- WebBrowserNavigatingEventHandler.cs
- ClientRuntime.cs
- VersionedStream.cs
- AccessViolationException.cs
- WindowsListViewItem.cs
- PageRanges.cs
- UnmanagedMarshal.cs
- HotSpotCollection.cs
- LinqDataSourceDisposeEventArgs.cs
- WSSecurityXXX2005.cs
- ChildChangedEventArgs.cs
- QuerySetOp.cs
- ToolboxSnapDragDropEventArgs.cs
- ReadWriteObjectLock.cs
- WrappingXamlSchemaContext.cs
- XmlAnyElementAttribute.cs
- UniqueEventHelper.cs
- ChangeTracker.cs
- PingOptions.cs
- PartialCachingControl.cs
- IfJoinedCondition.cs
- SqlCaseSimplifier.cs
- CollectionViewSource.cs
- WinEventTracker.cs
- EntitySetBase.cs
- SQLInt32Storage.cs
- FileUpload.cs
- Resources.Designer.cs
- ResXDataNode.cs
- Grid.cs