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
- WinInetCache.cs
- DockPattern.cs
- ListViewGroupItemCollection.cs
- MDIClient.cs
- SQLMembershipProvider.cs
- Schema.cs
- TreeViewTemplateSelector.cs
- ProfileGroupSettings.cs
- OleDbDataAdapter.cs
- DatatypeImplementation.cs
- CompiledQuery.cs
- ImageField.cs
- BaseTemplateParser.cs
- ApplicationFileParser.cs
- Error.cs
- TextEndOfParagraph.cs
- PointLight.cs
- DbProviderManifest.cs
- IInstanceTable.cs
- Calendar.cs
- EntityClassGenerator.cs
- GlyphingCache.cs
- DataAdapter.cs
- LayoutManager.cs
- StructureChangedEventArgs.cs
- ZipIORawDataFileBlock.cs
- IfAction.cs
- CorePropertiesFilter.cs
- EastAsianLunisolarCalendar.cs
- baseaxisquery.cs
- HostingEnvironmentException.cs
- SystemInfo.cs
- ControlValuePropertyAttribute.cs
- SafeThemeHandle.cs
- ServiceMetadataContractBehavior.cs
- AuthenticateEventArgs.cs
- ChangeTracker.cs
- BaseTreeIterator.cs
- ExtentKey.cs
- StylusPlugin.cs
- XhtmlStyleClass.cs
- DependencyObjectCodeDomSerializer.cs
- WindowHideOrCloseTracker.cs
- MachineKeyConverter.cs
- DateTimeOffsetStorage.cs
- altserialization.cs
- NegatedCellConstant.cs
- SrgsElement.cs
- DocumentPageView.cs
- ConfigurationSectionCollection.cs
- TemplateFactory.cs
- XmlSchemaComplexType.cs
- UIElement.cs
- HyperLinkField.cs
- XmlTextWriter.cs
- CategoryAttribute.cs
- DecimalConstantAttribute.cs
- DataGridViewCellStyleConverter.cs
- UIInitializationException.cs
- CachedPathData.cs
- MobileUITypeEditor.cs
- FilteredXmlReader.cs
- TextRunCache.cs
- SpellerHighlightLayer.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ImmutableCollection.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- DataService.cs
- ButtonRenderer.cs
- TextParaLineResult.cs
- NativeMethods.cs
- ILGen.cs
- MultitargetingHelpers.cs
- SafeNativeMethods.cs
- EntityChangedParams.cs
- TagPrefixAttribute.cs
- DataGridToolTip.cs
- DoubleConverter.cs
- Container.cs
- EditorBrowsableAttribute.cs
- PeerIPHelper.cs
- BitmapCache.cs
- ServicePointManager.cs
- WeakRefEnumerator.cs
- PathStreamGeometryContext.cs
- TdsEnums.cs
- DataGridClipboardCellContent.cs
- CompleteWizardStep.cs
- GridItemCollection.cs
- SafeNativeMethods.cs
- HtmlElementErrorEventArgs.cs
- CollectionType.cs
- FrameAutomationPeer.cs
- ParameterCollection.cs
- _PooledStream.cs
- CallTemplateAction.cs
- AtlasWeb.Designer.cs
- TreeWalkHelper.cs
- ReverseInheritProperty.cs
- DocumentsTrace.cs