Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
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);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PipeSecurity.cs
- Scheduler.cs
- Control.cs
- MailAddressCollection.cs
- SmtpNetworkElement.cs
- XamlStyleSerializer.cs
- WindowsFormsLinkLabel.cs
- StoryFragments.cs
- DocumentPageTextView.cs
- TemplateNameScope.cs
- shaperfactory.cs
- CodeStatementCollection.cs
- InvalidComObjectException.cs
- CommonDialog.cs
- PointConverter.cs
- AppDomainAttributes.cs
- SignedInfo.cs
- DateTimeConstantAttribute.cs
- Misc.cs
- XamlStyleSerializer.cs
- CookieHandler.cs
- TreeViewCancelEvent.cs
- TemplateXamlTreeBuilder.cs
- Control.cs
- RectAnimationUsingKeyFrames.cs
- ManifestResourceInfo.cs
- XmlPreloadedResolver.cs
- ExpressionReplacer.cs
- RijndaelManagedTransform.cs
- HandledEventArgs.cs
- CommentEmitter.cs
- InternalUserCancelledException.cs
- WebPartDescriptionCollection.cs
- ClientTarget.cs
- WebPart.cs
- DocumentGridContextMenu.cs
- SoapProtocolImporter.cs
- EntityDataReader.cs
- PenThread.cs
- AssertSection.cs
- PathFigureCollectionConverter.cs
- ServiceHttpModule.cs
- PolyQuadraticBezierSegment.cs
- ValueType.cs
- XPathAncestorQuery.cs
- SQLSingleStorage.cs
- XmlBaseReader.cs
- Rotation3DKeyFrameCollection.cs
- VBIdentifierNameEditor.cs
- MinimizableAttributeTypeConverter.cs
- NativeMethods.cs
- ChooseAction.cs
- TextChange.cs
- StorageEndPropertyMapping.cs
- LicFileLicenseProvider.cs
- WebPartZoneCollection.cs
- MSAAWinEventWrap.cs
- PathNode.cs
- SqlDataSourceView.cs
- InteropTrackingRecord.cs
- DebugHandleTracker.cs
- SelectionPatternIdentifiers.cs
- ExceptionRoutedEventArgs.cs
- GeometryCombineModeValidation.cs
- LinearGradientBrush.cs
- DesignTimeType.cs
- DataGridTable.cs
- ProviderSettings.cs
- DataGridViewLinkColumn.cs
- WindowProviderWrapper.cs
- ClrProviderManifest.cs
- ViewBox.cs
- MorphHelper.cs
- TypeHelper.cs
- Debugger.cs
- SecurityContext.cs
- ScriptRegistrationManager.cs
- SerializerDescriptor.cs
- BaseProcessor.cs
- DefaultPrintController.cs
- StateMachineHelpers.cs
- SqlStream.cs
- DoubleAnimationUsingKeyFrames.cs
- QilPatternVisitor.cs
- hwndwrapper.cs
- GroupItem.cs
- ConfigurationHandlersInstallComponent.cs
- AdornerLayer.cs
- PropertyFilter.cs
- BindingWorker.cs
- WebPartMenuStyle.cs
- SoapExtensionReflector.cs
- RequestCache.cs
- UIElementIsland.cs
- RadioButtonList.cs
- PrincipalPermission.cs
- AutomationProperty.cs
- QilParameter.cs
- Rotation3DAnimation.cs
- Soap.cs