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
- errorpatternmatcher.cs
- MapPathBasedVirtualPathProvider.cs
- PolyLineSegmentFigureLogic.cs
- XmlAttributeAttribute.cs
- PageSetupDialog.cs
- XmlReflectionMember.cs
- EdmPropertyAttribute.cs
- COM2TypeInfoProcessor.cs
- SecurityRequiresReviewAttribute.cs
- WebPermission.cs
- Encoder.cs
- EntityDataSourceDataSelection.cs
- ObjectKeyFrameCollection.cs
- Soap12ProtocolImporter.cs
- CodeAttributeArgument.cs
- CompletionProxy.cs
- PaintEvent.cs
- ReliableChannelBinder.cs
- XmlILModule.cs
- SecurityPermission.cs
- NodeLabelEditEvent.cs
- DictionaryKeyPropertyAttribute.cs
- HighlightComponent.cs
- XmlCharCheckingWriter.cs
- MenuTracker.cs
- DataBindingExpressionBuilder.cs
- SerialPort.cs
- WebPartCloseVerb.cs
- FastEncoderWindow.cs
- HtmlElementCollection.cs
- TreeViewItemAutomationPeer.cs
- Crypto.cs
- WebPartConnectionsDisconnectVerb.cs
- BinHexEncoding.cs
- SocketAddress.cs
- NullToBooleanConverter.cs
- LogExtent.cs
- PerformanceCounterPermission.cs
- IItemContainerGenerator.cs
- DictionaryItemsCollection.cs
- ReflectionTypeLoadException.cs
- CodeTypeDelegate.cs
- QilParameter.cs
- SimpleParser.cs
- AssociationEndMember.cs
- dataSvcMapFileLoader.cs
- TypedCompletedAsyncResult.cs
- LineGeometry.cs
- ControlUtil.cs
- CustomPopupPlacement.cs
- WhitespaceRule.cs
- XmlDictionary.cs
- RepeatBehavior.cs
- MetadataSerializer.cs
- BitmapMetadataEnumerator.cs
- ReaderOutput.cs
- UserPreferenceChangingEventArgs.cs
- WebPartDisplayModeCancelEventArgs.cs
- IntSecurity.cs
- ModifierKeysValueSerializer.cs
- BamlBinaryWriter.cs
- LogPolicy.cs
- ObjectAssociationEndMapping.cs
- CompositeActivityCodeGenerator.cs
- ExpressionDumper.cs
- ConfigurationLockCollection.cs
- TailCallAnalyzer.cs
- Expander.cs
- ServiceBusyException.cs
- TextElementEditingBehaviorAttribute.cs
- MessageHeaderT.cs
- mediaclock.cs
- thaishape.cs
- MemberAssignmentAnalysis.cs
- UInt32.cs
- EndpointAddressAugust2004.cs
- XmlHelper.cs
- HelpKeywordAttribute.cs
- CapabilitiesPattern.cs
- SecurityTokenRequirement.cs
- uribuilder.cs
- BinaryFormatter.cs
- CodeIdentifiers.cs
- XPathArrayIterator.cs
- DocumentGridPage.cs
- HMACRIPEMD160.cs
- ByteStorage.cs
- ResourceManagerWrapper.cs
- MetadataPropertyCollection.cs
- ToolStripProgressBar.cs
- DataReceivedEventArgs.cs
- precedingquery.cs
- WorkflowItemPresenter.cs
- QueryableDataSource.cs
- MetadataConversionError.cs
- AppearanceEditorPart.cs
- TableCell.cs
- XamlTypeMapperSchemaContext.cs
- TrackingLocationCollection.cs
- Pkcs7Recipient.cs