Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Mail / ClosableStream.cs / 1305376 / 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
- PathFigure.cs
- WebSysDisplayNameAttribute.cs
- ColorDialog.cs
- RotateTransform3D.cs
- GeneralTransform3DGroup.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- LeftCellWrapper.cs
- DataGridViewSelectedCellCollection.cs
- CustomGrammar.cs
- InputLanguageCollection.cs
- NestedContainer.cs
- FloaterBaseParaClient.cs
- ConnectionConsumerAttribute.cs
- TagNameToTypeMapper.cs
- Hyperlink.cs
- TypedLocationWrapper.cs
- securitycriticaldata.cs
- PropertyTabChangedEvent.cs
- DynamicQueryStringParameter.cs
- ComponentTray.cs
- InplaceBitmapMetadataWriter.cs
- XmlObjectSerializerWriteContext.cs
- SetterBaseCollection.cs
- PanelDesigner.cs
- SessionStateItemCollection.cs
- ButtonChrome.cs
- LayoutTableCell.cs
- SHA512Cng.cs
- ContentDisposition.cs
- safePerfProviderHandle.cs
- EventHandlerList.cs
- EmptyQuery.cs
- TransformValueSerializer.cs
- ActivityTypeDesigner.xaml.cs
- AddDataControlFieldDialog.cs
- ToolStripItemImageRenderEventArgs.cs
- FullTrustAssembly.cs
- SQLDouble.cs
- SerializationBinder.cs
- ColumnMapVisitor.cs
- TextDocumentView.cs
- ProviderConnectionPointCollection.cs
- DataFieldCollectionEditor.cs
- ToolStripPanelDesigner.cs
- ListBoxItemAutomationPeer.cs
- KoreanCalendar.cs
- ExtendedPropertyDescriptor.cs
- TreeViewItemAutomationPeer.cs
- SiteMapNodeItem.cs
- PeerNameRecord.cs
- ToolStripItemCollection.cs
- SizeF.cs
- TableLayoutPanel.cs
- Context.cs
- ConsumerConnectionPoint.cs
- DataBoundLiteralControl.cs
- RelationalExpressions.cs
- TextElementAutomationPeer.cs
- WebBrowser.cs
- SoundPlayer.cs
- XmlQueryOutput.cs
- HttpCachePolicy.cs
- DesignerProperties.cs
- OptimalTextSource.cs
- SynchronousReceiveBehavior.cs
- AssemblyBuilder.cs
- TreeViewEvent.cs
- RequestCacheEntry.cs
- DataTemplateSelector.cs
- Point.cs
- SafeCryptoHandles.cs
- HttpListenerRequestUriBuilder.cs
- QuaternionRotation3D.cs
- WindowsListView.cs
- ReadOnlyPermissionSet.cs
- XmlSequenceWriter.cs
- AssemblyGen.cs
- OdbcPermission.cs
- OperationCanceledException.cs
- State.cs
- MultitargetUtil.cs
- LinqDataSourceDisposeEventArgs.cs
- TypeSource.cs
- ControlValuePropertyAttribute.cs
- OuterGlowBitmapEffect.cs
- FlowDocumentFormatter.cs
- RequestSecurityTokenResponse.cs
- ParameterCollection.cs
- DesignTableCollection.cs
- FlowNode.cs
- DockProviderWrapper.cs
- FontFamilyConverter.cs
- PackageStore.cs
- MemoryRecordBuffer.cs
- QilName.cs
- TemplatePartAttribute.cs
- XmlDocument.cs
- WebPartDesigner.cs
- Size.cs
- JsonWriter.cs