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
- GetKeyedHashRequest.cs
- OrderedDictionary.cs
- TextCharacters.cs
- TextRange.cs
- CodeValidator.cs
- CapabilitiesState.cs
- ScrollChrome.cs
- URLString.cs
- AttributeCollection.cs
- SoapObjectWriter.cs
- ChineseLunisolarCalendar.cs
- CodeGotoStatement.cs
- DataSet.cs
- Span.cs
- PageVisual.cs
- MultidimensionalArrayItemReference.cs
- Internal.cs
- EntityCommandExecutionException.cs
- XmlQueryStaticData.cs
- TokenBasedSetEnumerator.cs
- DataSourceControl.cs
- KerberosSecurityTokenProvider.cs
- ObjectConverter.cs
- InfoCardArgumentException.cs
- Interop.cs
- ManipulationStartingEventArgs.cs
- ErrorCodes.cs
- DataGridViewCellCollection.cs
- WindowsGraphics.cs
- WebPartTracker.cs
- IPPacketInformation.cs
- FileDialogPermission.cs
- ExtensionWindowHeader.cs
- AsymmetricSecurityProtocolFactory.cs
- ValueUtilsSmi.cs
- AppSettingsReader.cs
- FlowDocumentReaderAutomationPeer.cs
- PeerCredential.cs
- WorkflowCommandExtensionItem.cs
- ImageCodecInfoPrivate.cs
- NetNamedPipeSecurityMode.cs
- ImageBrush.cs
- WebPartHelpVerb.cs
- TableCell.cs
- MetaType.cs
- SoapFault.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- EventMap.cs
- UnsafeNativeMethodsCLR.cs
- PersonalizationProvider.cs
- TrackingMemoryStreamFactory.cs
- RowUpdatingEventArgs.cs
- ElementHostPropertyMap.cs
- Profiler.cs
- ObjectDataSourceSelectingEventArgs.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- Timer.cs
- BitmapEffectInputData.cs
- ControlUtil.cs
- SQLDouble.cs
- TableLayoutStyle.cs
- UInt32Converter.cs
- EntityDataSourceReferenceGroup.cs
- InputDevice.cs
- EdmScalarPropertyAttribute.cs
- ChangePassword.cs
- State.cs
- ResourceWriter.cs
- VirtualDirectoryMapping.cs
- PointHitTestResult.cs
- X509PeerCertificateElement.cs
- UserNamePasswordClientCredential.cs
- JulianCalendar.cs
- MenuScrollingVisibilityConverter.cs
- InstanceOwner.cs
- TreeNodeStyle.cs
- ExceptionWrapper.cs
- FromReply.cs
- NetSectionGroup.cs
- _OverlappedAsyncResult.cs
- WmlCommandAdapter.cs
- FormatterServices.cs
- ReadWriteObjectLock.cs
- DataDocumentXPathNavigator.cs
- ColorAnimation.cs
- ConnectionProviderAttribute.cs
- ProfilePropertySettingsCollection.cs
- ContractValidationHelper.cs
- TraceSource.cs
- ActiveDocumentEvent.cs
- PasswordDeriveBytes.cs
- FontStretches.cs
- ExpandedWrapper.cs
- ConfigurationPropertyAttribute.cs
- SystemIPGlobalProperties.cs
- Debug.cs
- ResourceDisplayNameAttribute.cs
- QueryOutputWriterV1.cs
- TypeTypeConverter.cs
- SharedPerformanceCounter.cs