Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / Mail / ClosableStream.cs / 1 / ClosableStream.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net
{
using System;
using System.IO;
using System.Threading;
///
/// Provides a stream that notifies an event when the Close method
/// is called.
///
internal class ClosableStream : DelegatedStream
{
EventHandler onClose;
int closed;
internal ClosableStream(Stream stream, EventHandler onClose) : base(stream)
{
this.onClose = onClose;
}
public override void Close()
{
if (Interlocked.Increment(ref closed) == 1)
if (this.onClose != null)
this.onClose(this, new EventArgs());
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net
{
using System;
using System.IO;
using System.Threading;
///
/// Provides a stream that notifies an event when the Close method
/// is called.
///
internal class ClosableStream : DelegatedStream
{
EventHandler onClose;
int closed;
internal ClosableStream(Stream stream, EventHandler onClose) : base(stream)
{
this.onClose = onClose;
}
public override void Close()
{
if (Interlocked.Increment(ref closed) == 1)
if (this.onClose != null)
this.onClose(this, new EventArgs());
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlChildEnumerator.cs
- _BasicClient.cs
- tooltip.cs
- ToolStripSystemRenderer.cs
- SwitchElementsCollection.cs
- Int64Storage.cs
- _LoggingObject.cs
- LongValidatorAttribute.cs
- HtmlTableRowCollection.cs
- QilStrConcatenator.cs
- ResXResourceReader.cs
- OutputScopeManager.cs
- BulletDecorator.cs
- VisualTreeHelper.cs
- Merger.cs
- HyperlinkAutomationPeer.cs
- XmlSerializationReader.cs
- SqlDataSourceView.cs
- FileUtil.cs
- MediaTimeline.cs
- CompareInfo.cs
- RequiredAttributeAttribute.cs
- StringAnimationUsingKeyFrames.cs
- CancellationHandlerDesigner.cs
- ContainerUtilities.cs
- UnsafeNativeMethods.cs
- UIElementCollection.cs
- ZipIOExtraField.cs
- WorkflowInstanceTerminatedRecord.cs
- StrongNamePublicKeyBlob.cs
- UInt32Converter.cs
- KernelTypeValidation.cs
- HijriCalendar.cs
- XmlTextWriter.cs
- EDesignUtil.cs
- SecurityTimestamp.cs
- ImagingCache.cs
- ControlCachePolicy.cs
- HttpFileCollection.cs
- NumericUpDownAccelerationCollection.cs
- CommandEventArgs.cs
- XmlFormatWriterGenerator.cs
- StyleCollection.cs
- WinFormsSecurity.cs
- X509Chain.cs
- HttpRuntime.cs
- EntityDesignerUtils.cs
- Geometry3D.cs
- Odbc32.cs
- ToolStripLabel.cs
- HttpWriter.cs
- XmlSerializerFormatAttribute.cs
- SystemIPGlobalProperties.cs
- EntityFrameworkVersions.cs
- ColumnWidthChangingEvent.cs
- FrameworkElementFactory.cs
- SHA512Managed.cs
- BinaryExpression.cs
- CodeAccessSecurityEngine.cs
- TextDpi.cs
- FunctionNode.cs
- MenuItemStyleCollection.cs
- ActivityExecutionContextCollection.cs
- Validator.cs
- InkPresenterAutomationPeer.cs
- PresentationTraceSources.cs
- TraceLevelHelper.cs
- PolyQuadraticBezierSegment.cs
- SecureUICommand.cs
- FieldToken.cs
- TemplateXamlTreeBuilder.cs
- HttpContextWrapper.cs
- ValidationResult.cs
- QueryNode.cs
- ExpressionEditorAttribute.cs
- SelectionHighlightInfo.cs
- AdministrationHelpers.cs
- ElementAction.cs
- SmiGettersStream.cs
- QuaternionKeyFrameCollection.cs
- SourceSwitch.cs
- HttpHandler.cs
- InfiniteTimeSpanConverter.cs
- DbConnectionStringCommon.cs
- XmlUrlResolver.cs
- RadioButton.cs
- SQlBooleanStorage.cs
- DeviceOverridableAttribute.cs
- _NTAuthentication.cs
- SQLBytes.cs
- SqlDataSourceEnumerator.cs
- ImageAutomationPeer.cs
- CustomErrorsSectionWrapper.cs
- SystemIPv4InterfaceProperties.cs
- ReflectionPermission.cs
- DataGridViewToolTip.cs
- ImageMap.cs
- DrawingContextWalker.cs
- SystemColorTracker.cs
- CodeSubDirectory.cs