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
- DataSourceConverter.cs
- CalendarData.cs
- _UriTypeConverter.cs
- OraclePermission.cs
- PropertyBuilder.cs
- TextSimpleMarkerProperties.cs
- NumericUpDownAcceleration.cs
- PtsHost.cs
- ConfigXmlText.cs
- Logging.cs
- WebServiceClientProxyGenerator.cs
- EdmSchemaError.cs
- RegexNode.cs
- DiscreteKeyFrames.cs
- ParameterCollection.cs
- BamlLocalizer.cs
- BufferedGraphicsManager.cs
- WebBrowsableAttribute.cs
- AsyncPostBackTrigger.cs
- XmlSignatureProperties.cs
- OdbcInfoMessageEvent.cs
- XmlAutoDetectWriter.cs
- CmsUtils.cs
- InputBuffer.cs
- IUnknownConstantAttribute.cs
- Oid.cs
- HttpDebugHandler.cs
- OdbcConnectionStringbuilder.cs
- ChannelParameterCollection.cs
- VirtualPathProvider.cs
- BasicExpressionVisitor.cs
- ObjectDataSourceMethodEventArgs.cs
- MessagingActivityHelper.cs
- MergablePropertyAttribute.cs
- ComboBoxItem.cs
- MobileTextWriter.cs
- dataprotectionpermission.cs
- FontUnit.cs
- StatusBarDrawItemEvent.cs
- RequestCachePolicyConverter.cs
- ConfigurationStrings.cs
- ReadOnlyDictionary.cs
- XmlLinkedNode.cs
- PlainXmlDeserializer.cs
- safex509handles.cs
- PersonalizablePropertyEntry.cs
- UnhandledExceptionEventArgs.cs
- BindingMAnagerBase.cs
- GeneralTransformGroup.cs
- ServiceDescriptionSerializer.cs
- NamespaceEmitter.cs
- BaseCollection.cs
- StrokeNodeOperations.cs
- Rotation3DAnimationBase.cs
- Viewport3DVisual.cs
- XmlChildEnumerator.cs
- Binding.cs
- FontInfo.cs
- HtmlForm.cs
- Int32RectConverter.cs
- JapaneseLunisolarCalendar.cs
- ContainerParagraph.cs
- SplineQuaternionKeyFrame.cs
- XmlSchemaValidationException.cs
- PerformanceCounterScope.cs
- TranslateTransform3D.cs
- FigureParagraph.cs
- ChannelHandler.cs
- TokenCreationException.cs
- SelectionGlyph.cs
- InvokeBase.cs
- GlyphingCache.cs
- datacache.cs
- XPathException.cs
- XmlDataCollection.cs
- WebUtil.cs
- TypeAccessException.cs
- SimpleMailWebEventProvider.cs
- querybuilder.cs
- StorageMappingItemLoader.cs
- TransformationRules.cs
- TextCompositionManager.cs
- XomlCompilerResults.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- RuleAttributes.cs
- TransactionTable.cs
- CaseInsensitiveHashCodeProvider.cs
- XNameTypeConverter.cs
- SourceFileBuildProvider.cs
- HtmlInputPassword.cs
- CompilerTypeWithParams.cs
- EnumConverter.cs
- MetadataWorkspace.cs
- RouteItem.cs
- ConfigViewGenerator.cs
- ToolStripLabel.cs
- DataBinding.cs
- WebPartConnectionsConnectVerb.cs
- JoinQueryOperator.cs
- CompatibleComparer.cs