Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Mail / AlternateViewCollection.cs / 1305376 / AlternateViewCollection.cs
using System; using System.Collections.ObjectModel; namespace System.Net.Mail { public sealed class AlternateViewCollection : Collection, IDisposable { bool disposed = false; internal AlternateViewCollection() { } public void Dispose() { if (disposed) { return; } foreach (AlternateView view in this) { view.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, AlternateView 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, AlternateView 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 AlternateViewCollection : Collection , IDisposable { bool disposed = false; internal AlternateViewCollection() { } public void Dispose() { if (disposed) { return; } foreach (AlternateView view in this) { view.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, AlternateView 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, AlternateView 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
- PageAsyncTaskManager.cs
- BaseInfoTable.cs
- FocusChangedEventArgs.cs
- Int32CollectionConverter.cs
- SecurityTokenException.cs
- CreateUserWizardStep.cs
- UnsafeNativeMethods.cs
- RemotingAttributes.cs
- XmlDictionaryReaderQuotas.cs
- StaticSiteMapProvider.cs
- DetailsViewRowCollection.cs
- SafeWaitHandle.cs
- SerialReceived.cs
- InputLanguageProfileNotifySink.cs
- ProtectedConfiguration.cs
- WindowsButton.cs
- DataServicePagingProviderWrapper.cs
- SequenceDesigner.cs
- EntityParameterCollection.cs
- UseAttributeSetsAction.cs
- Function.cs
- XmlSerializerOperationFormatter.cs
- RegexCode.cs
- Permission.cs
- ISO2022Encoding.cs
- ReadOnlyAttribute.cs
- TextViewSelectionProcessor.cs
- GenericAuthenticationEventArgs.cs
- AdapterUtil.cs
- XmlConverter.cs
- BasicViewGenerator.cs
- TreeNodeBindingDepthConverter.cs
- HtmlAnchor.cs
- Token.cs
- ProcessHostFactoryHelper.cs
- ChtmlCalendarAdapter.cs
- SystemInformation.cs
- CollectionChangedEventManager.cs
- CallbackValidator.cs
- _ConnectOverlappedAsyncResult.cs
- IndexedEnumerable.cs
- LoggedException.cs
- SponsorHelper.cs
- HitTestParameters.cs
- XmlTypeAttribute.cs
- TypeDefinition.cs
- DbConnectionFactory.cs
- DataGridViewCellCollection.cs
- HandlerBase.cs
- PathFigureCollection.cs
- Triplet.cs
- RSAPKCS1KeyExchangeFormatter.cs
- SQLConvert.cs
- DayRenderEvent.cs
- AncestorChangedEventArgs.cs
- GZipStream.cs
- Helper.cs
- DoubleKeyFrameCollection.cs
- WebPermission.cs
- WebPartsSection.cs
- Utils.cs
- FactoryGenerator.cs
- XmlQueryStaticData.cs
- MenuBindingsEditor.cs
- IndexingContentUnit.cs
- ListSortDescription.cs
- ConditionCollection.cs
- HttpValueCollection.cs
- Misc.cs
- QuotedPrintableStream.cs
- configsystem.cs
- SmiConnection.cs
- ContentElement.cs
- PropertyDescriptorGridEntry.cs
- DataViewManagerListItemTypeDescriptor.cs
- TimelineClockCollection.cs
- Matrix3D.cs
- MSAAWinEventWrap.cs
- nulltextcontainer.cs
- Variant.cs
- ReverseInheritProperty.cs
- StrongNameKeyPair.cs
- Completion.cs
- ToolStripContentPanelDesigner.cs
- Operator.cs
- SectionRecord.cs
- ClientSession.cs
- XmlDataSourceNodeDescriptor.cs
- ListenerConfig.cs
- CopyAction.cs
- CompositionAdorner.cs
- FontStretchConverter.cs
- TextPattern.cs
- DataGridViewComboBoxColumn.cs
- HierarchicalDataSourceControl.cs
- KeyConverter.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DecimalConstantAttribute.cs
- DrawingAttributesDefaultValueFactory.cs
- ClientSettings.cs