Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Net / System / Net / Mail / LinkedResourceCollection.cs / 1 / LinkedResourceCollection.cs
using System; using System.Collections.ObjectModel; namespace System.Net.Mail { public sealed class LinkedResourceCollection : Collection, IDisposable { bool disposed = false; internal LinkedResourceCollection() { } public void Dispose() { if(disposed){ return; } foreach (LinkedResource resource in this) { resource.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, LinkedResource 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, LinkedResource 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 { public sealed class LinkedResourceCollection : Collection , IDisposable { bool disposed = false; internal LinkedResourceCollection() { } public void Dispose() { if(disposed){ return; } foreach (LinkedResource resource in this) { resource.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, LinkedResource 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, LinkedResource 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
- ContentFileHelper.cs
- LexicalChunk.cs
- EntityCommandCompilationException.cs
- URIFormatException.cs
- Span.cs
- WindowShowOrOpenTracker.cs
- ComContractElement.cs
- StatusBarDrawItemEvent.cs
- MsmqVerifier.cs
- ProxyAttribute.cs
- DBCommand.cs
- BrowserCapabilitiesCodeGenerator.cs
- TokenFactoryFactory.cs
- DetailsViewModeEventArgs.cs
- CqlErrorHelper.cs
- HMACMD5.cs
- _BaseOverlappedAsyncResult.cs
- StylusPointCollection.cs
- AlphaSortedEnumConverter.cs
- X509CertificateCollection.cs
- ValueExpressions.cs
- ActivityDesignerResources.cs
- PlainXmlWriter.cs
- DesignerImageAdapter.cs
- SqlOuterApplyReducer.cs
- ValueQuery.cs
- CodeTypeDeclaration.cs
- ScriptingProfileServiceSection.cs
- XmlParser.cs
- XamlRtfConverter.cs
- XmlUtil.cs
- ConsumerConnectionPointCollection.cs
- RefreshEventArgs.cs
- TcpProcessProtocolHandler.cs
- Error.cs
- AutoGeneratedFieldProperties.cs
- AuthenticationModulesSection.cs
- TabletDeviceInfo.cs
- DllNotFoundException.cs
- ViewManager.cs
- TextWriterTraceListener.cs
- Int32RectConverter.cs
- EditorAttribute.cs
- WindowsBrush.cs
- ToolStripPanelCell.cs
- InternalTypeHelper.cs
- FastEncoder.cs
- XsltLibrary.cs
- PageStatePersister.cs
- SqlClientFactory.cs
- IisTraceListener.cs
- AnimationLayer.cs
- BuildResultCache.cs
- PackagePartCollection.cs
- TextBoxRenderer.cs
- Vector3DCollection.cs
- COM2PropertyPageUITypeConverter.cs
- CodeThrowExceptionStatement.cs
- MouseActionConverter.cs
- ScrollBarAutomationPeer.cs
- TreeViewHitTestInfo.cs
- ReferentialConstraint.cs
- TextDecorationLocationValidation.cs
- ClientSession.cs
- Bezier.cs
- SqlLiftIndependentRowExpressions.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- LoadedEvent.cs
- StateItem.cs
- NavigationPropertyEmitter.cs
- XmlElementList.cs
- ObjectSecurityT.cs
- X509Utils.cs
- ReferencedAssemblyResolver.cs
- XmlSerializationReader.cs
- XmlTextAttribute.cs
- InputProcessorProfiles.cs
- WebPartZoneBase.cs
- ButtonFlatAdapter.cs
- ScaleTransform.cs
- PropertyPathConverter.cs
- SymLanguageVendor.cs
- validationstate.cs
- SubpageParagraph.cs
- TraceLevelStore.cs
- JoinGraph.cs
- HttpsChannelListener.cs
- IODescriptionAttribute.cs
- GatewayIPAddressInformationCollection.cs
- dbenumerator.cs
- SiteMapSection.cs
- TemplateInstanceAttribute.cs
- SyndicationContent.cs
- SafePointer.cs
- BCLDebug.cs
- TreeChangeInfo.cs
- ScopeCollection.cs
- DaylightTime.cs
- UnmanagedMarshal.cs
- initElementDictionary.cs