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
- StateMachineExecutionState.cs
- ResXFileRef.cs
- DataTablePropertyDescriptor.cs
- Container.cs
- MultipleCopiesCollection.cs
- DBSqlParserTable.cs
- Types.cs
- Helpers.cs
- TableAdapterManagerHelper.cs
- ApplicationFileParser.cs
- PeerInvitationResponse.cs
- CompModSwitches.cs
- TemplateBindingExpressionConverter.cs
- ComboBox.cs
- MobileControl.cs
- OracleFactory.cs
- DbDataSourceEnumerator.cs
- ContextMarshalException.cs
- SoapSchemaMember.cs
- UidManager.cs
- EdmMember.cs
- SizeAnimationUsingKeyFrames.cs
- WebPartActionVerb.cs
- CookielessHelper.cs
- HtmlButton.cs
- RoleBoolean.cs
- SecurityContext.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- ActiveXContainer.cs
- CheckBoxFlatAdapter.cs
- PagerSettings.cs
- ConfigurationException.cs
- UndoManager.cs
- IconHelper.cs
- NegotiateStream.cs
- ColorConvertedBitmapExtension.cs
- SymbolPair.cs
- TextFindEngine.cs
- JobInputBins.cs
- ConstraintEnumerator.cs
- StringSource.cs
- SqlDependency.cs
- DiscardableAttribute.cs
- PageParser.cs
- WrapPanel.cs
- FileResponseElement.cs
- Win32SafeHandles.cs
- AppDomainManager.cs
- TextPointer.cs
- LinearKeyFrames.cs
- RuntimeResourceSet.cs
- HwndTarget.cs
- RoleService.cs
- CompleteWizardStep.cs
- StubHelpers.cs
- KoreanCalendar.cs
- JulianCalendar.cs
- DoubleLinkList.cs
- IndexerReference.cs
- TextTreeTextNode.cs
- ContentPlaceHolderDesigner.cs
- TraceHandler.cs
- XsdDuration.cs
- PerformanceCountersElement.cs
- IgnoreDataMemberAttribute.cs
- CodeAccessPermission.cs
- CheckBoxFlatAdapter.cs
- QilList.cs
- Convert.cs
- TextAdaptor.cs
- MenuItem.cs
- TypeSystem.cs
- DynamicExpression.cs
- PropertyChangedEventArgs.cs
- HandleValueEditor.cs
- FixedLineResult.cs
- LongSumAggregationOperator.cs
- DataSourceConverter.cs
- WindowsFormsSectionHandler.cs
- DataGridTextBoxColumn.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- EnvironmentPermission.cs
- UriTemplateLiteralPathSegment.cs
- ProcessModelSection.cs
- RoutedEventHandlerInfo.cs
- ListBoxItem.cs
- XmlBaseWriter.cs
- CompensateDesigner.cs
- SplitContainerDesigner.cs
- BlurBitmapEffect.cs
- PointCollectionConverter.cs
- InputReportEventArgs.cs
- StylusButtonCollection.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- EmbeddedObject.cs
- HttpCookie.cs
- CacheChildrenQuery.cs
- AtomMaterializer.cs
- CharConverter.cs
- XmlSchemaCompilationSettings.cs