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
- arc.cs
- XmlWrappingWriter.cs
- Policy.cs
- HttpServerVarsCollection.cs
- PrintPreviewControl.cs
- ToolStripDesignerAvailabilityAttribute.cs
- SessionParameter.cs
- ConnectionConsumerAttribute.cs
- ThreadExceptionDialog.cs
- FilteredSchemaElementLookUpTable.cs
- GeometryCollection.cs
- CategoryGridEntry.cs
- dsa.cs
- lengthconverter.cs
- BigInt.cs
- MsmqBindingFilter.cs
- SecurityHeaderTokenResolver.cs
- OdbcStatementHandle.cs
- NamespaceEmitter.cs
- SwitchDesigner.xaml.cs
- PersonalizationEntry.cs
- BorderGapMaskConverter.cs
- HtmlInputControl.cs
- HashAlgorithm.cs
- RectValueSerializer.cs
- DisplayInformation.cs
- UrlMapping.cs
- SecurityTokenTypes.cs
- Enumerable.cs
- XPathBinder.cs
- WMIGenerator.cs
- VBCodeProvider.cs
- BindToObject.cs
- GatewayDefinition.cs
- DataTableMappingCollection.cs
- CodeMemberProperty.cs
- Font.cs
- OutputWindow.cs
- PageCodeDomTreeGenerator.cs
- ConnectionStringSettingsCollection.cs
- AuthorizationRule.cs
- DataGridRowDetailsEventArgs.cs
- PluralizationServiceUtil.cs
- TileModeValidation.cs
- MSAANativeProvider.cs
- DSASignatureDeformatter.cs
- PropertyItemInternal.cs
- DataGridCommandEventArgs.cs
- SingleAnimationBase.cs
- SessionStateModule.cs
- Dynamic.cs
- LineBreak.cs
- Int16.cs
- OneOfScalarConst.cs
- Light.cs
- MessageBuffer.cs
- FormatException.cs
- BitmapVisualManager.cs
- CodeCompileUnit.cs
- TableLayoutCellPaintEventArgs.cs
- SqlUtils.cs
- TagNameToTypeMapper.cs
- MimeBasePart.cs
- WsdlInspector.cs
- WinInetCache.cs
- DeviceContext2.cs
- XmlValidatingReader.cs
- HtmlInputButton.cs
- WindowsGraphicsWrapper.cs
- DataGridViewCellParsingEventArgs.cs
- Root.cs
- ListViewItem.cs
- GrowingArray.cs
- ToolStripRenderEventArgs.cs
- ReflectTypeDescriptionProvider.cs
- OleDbConnection.cs
- LambdaValue.cs
- UnsafeNativeMethods.cs
- FigureParagraph.cs
- DispatcherFrame.cs
- FrameworkEventSource.cs
- DataControlFieldCollection.cs
- RangeValueProviderWrapper.cs
- ObjectDataSourceEventArgs.cs
- Compilation.cs
- IndexerNameAttribute.cs
- EmptyStringExpandableObjectConverter.cs
- Application.cs
- DesignerHost.cs
- ZoneIdentityPermission.cs
- MSG.cs
- VisualTarget.cs
- Stylesheet.cs
- MonikerHelper.cs
- BitmapEffectOutputConnector.cs
- ObjectListCommandCollection.cs
- Encoder.cs
- rsa.cs
- TextRunCache.cs
- GenericUriParser.cs