Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Mail / LinkedResourceCollection.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EraserBehavior.cs
- EnvelopedPkcs7.cs
- DeviceContext2.cs
- DataColumnChangeEvent.cs
- TransmissionStrategy.cs
- OraclePermission.cs
- SystemKeyConverter.cs
- PropertyDescriptorGridEntry.cs
- DynamicPhysicalDiscoSearcher.cs
- Storyboard.cs
- SqlTriggerAttribute.cs
- LogExtent.cs
- TextSelection.cs
- FontSourceCollection.cs
- ListDictionaryInternal.cs
- IPAddress.cs
- ColorTranslator.cs
- MappingModelBuildProvider.cs
- ImageIndexConverter.cs
- HtmlInputFile.cs
- EndCreateSecurityTokenRequest.cs
- SettingsAttributes.cs
- ByteViewer.cs
- EncodedStreamFactory.cs
- OracleBoolean.cs
- IIS7UserPrincipal.cs
- ExeConfigurationFileMap.cs
- EnumValidator.cs
- ISAPIWorkerRequest.cs
- XmlSequenceWriter.cs
- LocationFactory.cs
- TreeView.cs
- SemanticAnalyzer.cs
- ReaderWriterLock.cs
- DrawingAttributesDefaultValueFactory.cs
- OutOfMemoryException.cs
- MobileCapabilities.cs
- DataProtection.cs
- Rfc4050KeyFormatter.cs
- TypeConverterValueSerializer.cs
- RoleBoolean.cs
- GroupDescription.cs
- AnonymousIdentificationSection.cs
- DesignerResources.cs
- DispatcherHooks.cs
- XmlSchemaGroupRef.cs
- SafeCryptHandles.cs
- Int64Animation.cs
- CompressStream.cs
- WeakEventTable.cs
- LayoutEngine.cs
- RichTextBox.cs
- SqlMethods.cs
- OleDbDataReader.cs
- SignatureConfirmationElement.cs
- Frame.cs
- ElementProxy.cs
- HttpCapabilitiesSectionHandler.cs
- TextSearch.cs
- KeyedCollection.cs
- VirtualPathProvider.cs
- SecureEnvironment.cs
- AppLevelCompilationSectionCache.cs
- Operand.cs
- ProcessModuleCollection.cs
- Parallel.cs
- XmlSchemaObject.cs
- ResXResourceReader.cs
- DataBindingCollectionConverter.cs
- ConnectionPoint.cs
- Vertex.cs
- ServiceDocument.cs
- ChildDocumentBlock.cs
- XmlWriterTraceListener.cs
- ErrorFormatter.cs
- ImagingCache.cs
- BaseTemplateCodeDomTreeGenerator.cs
- XmlName.cs
- CodeEntryPointMethod.cs
- ProtectedConfigurationSection.cs
- ClientTarget.cs
- HandoffBehavior.cs
- StringBuilder.cs
- PackWebRequest.cs
- RestHandler.cs
- GlyphRunDrawing.cs
- QueueException.cs
- TabControlAutomationPeer.cs
- PreservationFileWriter.cs
- RadioButton.cs
- CookieHandler.cs
- EventProxy.cs
- Pair.cs
- ReflectTypeDescriptionProvider.cs
- OpCodes.cs
- WindowVisualStateTracker.cs
- CodeDelegateCreateExpression.cs
- TripleDESCryptoServiceProvider.cs
- MailWebEventProvider.cs
- EntityTypeEmitter.cs