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
- TypeUtil.cs
- ItemsControlAutomationPeer.cs
- CryptoKeySecurity.cs
- SchemaCreator.cs
- XmlUTF8TextWriter.cs
- OdbcFactory.cs
- BasicCommandTreeVisitor.cs
- SQLBinaryStorage.cs
- ProxyWebPartManager.cs
- SecurityNegotiationException.cs
- DrawingAttributesDefaultValueFactory.cs
- LineSegment.cs
- MDIControlStrip.cs
- XmlDigitalSignatureProcessor.cs
- IpcServerChannel.cs
- HttpRuntime.cs
- Int32Storage.cs
- ExtensionWindowHeader.cs
- BitStack.cs
- TypedReference.cs
- WebMethodAttribute.cs
- precedingquery.cs
- ByteConverter.cs
- WebPartDisplayModeCollection.cs
- EventMappingSettingsCollection.cs
- VisualStyleTypesAndProperties.cs
- StoreItemCollection.Loader.cs
- DbConnectionPoolGroupProviderInfo.cs
- WebException.cs
- ToolStripPanelCell.cs
- MetadataCacheItem.cs
- SafeCoTaskMem.cs
- ContentElementAutomationPeer.cs
- ApplicationSecurityManager.cs
- RecipientInfo.cs
- XmlSchemaObjectCollection.cs
- BaseComponentEditor.cs
- MachineSettingsSection.cs
- EdmToObjectNamespaceMap.cs
- WindowsAuthenticationEventArgs.cs
- WebEventTraceProvider.cs
- DynamicControlParameter.cs
- XhtmlTextWriter.cs
- CombinedGeometry.cs
- SimpleWebHandlerParser.cs
- SHA256.cs
- ModelFunctionTypeElement.cs
- PeerCollaboration.cs
- DesignerAdRotatorAdapter.cs
- PasswordPropertyTextAttribute.cs
- Scene3D.cs
- SqlDataReaderSmi.cs
- MatrixTransform3D.cs
- ProviderIncompatibleException.cs
- RuleRefElement.cs
- EventMappingSettingsCollection.cs
- MouseBinding.cs
- SelectionRangeConverter.cs
- CodeStatementCollection.cs
- ReachFixedPageSerializerAsync.cs
- DesignOnlyAttribute.cs
- XPathNodeHelper.cs
- ApplicationCommands.cs
- HandlerFactoryCache.cs
- XamlStyleSerializer.cs
- StateMachine.cs
- ProvidersHelper.cs
- DesignerAdRotatorAdapter.cs
- AsyncPostBackErrorEventArgs.cs
- SerializationUtilities.cs
- PropertySourceInfo.cs
- StrokeCollectionConverter.cs
- FontFamily.cs
- ScriptReference.cs
- JoinCqlBlock.cs
- XmlComplianceUtil.cs
- MetadataProperty.cs
- DesignerAutoFormat.cs
- KoreanCalendar.cs
- COM2PropertyDescriptor.cs
- BridgeDataReader.cs
- EmptyImpersonationContext.cs
- RichTextBox.cs
- SqlRowUpdatingEvent.cs
- DockPanel.cs
- ContextDataSource.cs
- ConstantCheck.cs
- Accessors.cs
- FrameworkReadOnlyPropertyMetadata.cs
- DbConnectionInternal.cs
- RowUpdatingEventArgs.cs
- TaskFileService.cs
- NameValueFileSectionHandler.cs
- WCFModelStrings.Designer.cs
- DotExpr.cs
- ComboBoxRenderer.cs
- WindowsIdentity.cs
- FileNotFoundException.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- RoutedCommand.cs