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
- HttpCacheVary.cs
- WindowsFormsSectionHandler.cs
- Inflater.cs
- AdjustableArrowCap.cs
- VSWCFServiceContractGenerator.cs
- HScrollProperties.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- WindowsPrincipal.cs
- httpapplicationstate.cs
- AttributeCollection.cs
- DataSourceCache.cs
- DetailsViewDeleteEventArgs.cs
- ElementProxy.cs
- BitmapPalette.cs
- oledbconnectionstring.cs
- HostExecutionContextManager.cs
- StateBag.cs
- DataContractSerializer.cs
- Events.cs
- TrackingMemoryStream.cs
- DataGridRelationshipRow.cs
- ActivitySurrogateSelector.cs
- ApplicationActivator.cs
- CompositeScriptReference.cs
- WebPartConnectionsCancelVerb.cs
- PropertyManager.cs
- DesignSurfaceCollection.cs
- HttpCookieCollection.cs
- ReadWriteObjectLock.cs
- HwndTarget.cs
- DragEventArgs.cs
- Processor.cs
- FontWeights.cs
- FloatMinMaxAggregationOperator.cs
- ParameterModifier.cs
- ErrorFormatter.cs
- XsltInput.cs
- FocusTracker.cs
- MediaElement.cs
- GrammarBuilderWildcard.cs
- Panel.cs
- NeutralResourcesLanguageAttribute.cs
- Math.cs
- InlineCategoriesDocument.cs
- OletxDependentTransaction.cs
- InternalConfigHost.cs
- Choices.cs
- XamlRtfConverter.cs
- DataGridGeneralPage.cs
- AuthenticateEventArgs.cs
- Point3DAnimationBase.cs
- SymLanguageType.cs
- Material.cs
- Zone.cs
- WindowsAuthenticationEventArgs.cs
- DataTableClearEvent.cs
- EventMappingSettings.cs
- UpDownEvent.cs
- UserControl.cs
- Parallel.cs
- WSFederationHttpBindingElement.cs
- DbQueryCommandTree.cs
- StringFreezingAttribute.cs
- AbstractExpressions.cs
- ComplusTypeValidator.cs
- VisualProxy.cs
- OperationCanceledException.cs
- ObjectStorage.cs
- Assembly.cs
- LinqDataSourceSelectEventArgs.cs
- DesignerUtility.cs
- NotSupportedException.cs
- EnumValidator.cs
- ExecutorLocksHeldException.cs
- IncrementalReadDecoders.cs
- BufferedReadStream.cs
- DataGridLinkButton.cs
- WindowsComboBox.cs
- ThreadStaticAttribute.cs
- CngAlgorithm.cs
- SchemaElementDecl.cs
- SubstitutionList.cs
- OdbcInfoMessageEvent.cs
- ManageRequest.cs
- FileSecurity.cs
- FlowPanelDesigner.cs
- OptionUsage.cs
- GridView.cs
- QuotedStringWriteStateInfo.cs
- DesignerLinkAdapter.cs
- Image.cs
- InvalidWMPVersionException.cs
- WindowsListViewItemCheckBox.cs
- DescendantBaseQuery.cs
- XmlSerializerFactory.cs
- PathStreamGeometryContext.cs
- ASCIIEncoding.cs
- RadioButtonStandardAdapter.cs
- UInt16Storage.cs
- XNodeNavigator.cs