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
- KnownBoxes.cs
- InvokePattern.cs
- EventPropertyMap.cs
- XPathNavigatorReader.cs
- EmbeddedObject.cs
- DataBinding.cs
- TreeView.cs
- MoveSizeWinEventHandler.cs
- ListViewItem.cs
- EventTask.cs
- LoginDesigner.cs
- ForceCopyBuildProvider.cs
- DbCommandTree.cs
- HttpAsyncResult.cs
- ExternalException.cs
- ErrorTableItemStyle.cs
- NaturalLanguageHyphenator.cs
- LinqDataSourceHelper.cs
- TextEndOfParagraph.cs
- DataSetMappper.cs
- BindingNavigatorDesigner.cs
- WindowsTab.cs
- DefinitionUpdate.cs
- HttpConfigurationSystem.cs
- ComponentEditorForm.cs
- ComponentGlyph.cs
- SqlDependencyUtils.cs
- GlobalAllocSafeHandle.cs
- DiscoveryClientReferences.cs
- ResourceReferenceKeyNotFoundException.cs
- SecurityContextSecurityTokenParameters.cs
- ObjectListCommandCollection.cs
- UnmanagedBitmapWrapper.cs
- XmlConvert.cs
- FolderNameEditor.cs
- ModelTypeConverter.cs
- DbConnectionPoolGroupProviderInfo.cs
- UrlPropertyAttribute.cs
- OutOfProcStateClientManager.cs
- EventLogEntryCollection.cs
- ConfigurationLockCollection.cs
- SelectedCellsCollection.cs
- EndpointAddress10.cs
- FormViewInsertEventArgs.cs
- DesignTimeVisibleAttribute.cs
- PageParser.cs
- Stroke2.cs
- ObjectManager.cs
- HashMembershipCondition.cs
- PolyQuadraticBezierSegment.cs
- MetadataArtifactLoaderComposite.cs
- MasterPageParser.cs
- RequestResizeEvent.cs
- UnaryExpression.cs
- ListViewItemSelectionChangedEvent.cs
- InvalidCardException.cs
- ObjectTypeMapping.cs
- ClassValidator.cs
- QilParameter.cs
- FontFamily.cs
- Wow64ConfigurationLoader.cs
- ComponentEditorPage.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- DefaultBinder.cs
- SimpleTypesSurrogate.cs
- TypeExtensionConverter.cs
- RangeValueProviderWrapper.cs
- TransformerInfo.cs
- BuildProviderAppliesToAttribute.cs
- activationcontext.cs
- NotConverter.cs
- OneOfTypeConst.cs
- ClientBuildManager.cs
- CmsUtils.cs
- UniqueIdentifierService.cs
- DataStreamFromComStream.cs
- ToolstripProfessionalRenderer.cs
- Panel.cs
- TextCollapsingProperties.cs
- Simplifier.cs
- PersistenceTypeAttribute.cs
- SecureConversationServiceElement.cs
- CheckBoxList.cs
- TransactionManager.cs
- ReachVisualSerializer.cs
- XmlDataImplementation.cs
- PageRanges.cs
- ComplexBindingPropertiesAttribute.cs
- LogLogRecordHeader.cs
- TypedRowGenerator.cs
- SiteMapHierarchicalDataSourceView.cs
- PopupControlService.cs
- FixedSOMSemanticBox.cs
- Decimal.cs
- SHA1CryptoServiceProvider.cs
- AssociationType.cs
- ProcessModelSection.cs
- DataGridViewComboBoxCell.cs
- RedistVersionInfo.cs
- FlowDecision.cs