Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsHost / UnmanagedHandle.cs / 1305600 / UnmanagedHandle.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: UnmanagedHandle.cs // // Description: Definition for Unmanaged Handle. Provides identity (handle), // which can be used in unmanaged world. // // History: // 05/02/2003 : [....] - moving from Avalon branch. // //--------------------------------------------------------------------------- using System; namespace MS.Internal.PtsHost { ////// Provides identity (handle), which can be used in unmanaged world. /// If object is passed into unmanaged world, and there is a need to identify /// that object later on, its class should inherit from UnmanagedHandle. /// internal class UnmanagedHandle : IDisposable { ////// Constructor. Used when object derives from UnmanagedHandle. /// /// /// PTS context /// protected UnmanagedHandle(PtsContext ptsContext) { _ptsContext = ptsContext; _handle = ptsContext.CreateHandle(this); } ////// Dispose the object and release handle. /// public virtual void Dispose() { try { _ptsContext.ReleaseHandle(_handle); } finally { _handle = IntPtr.Zero; } GC.SuppressFinalize(this); } ////// Handle of an object. /// internal IntPtr Handle { get { return _handle; } } private IntPtr _handle; ////// PtsContext that is the owner of the handle. /// It is required to store it here for Dispose. When Dispose is called /// it is not always possible to get instance of PtsContext that /// has been used to create this handle. /// internal PtsContext PtsContext { get { return _ptsContext; } } private readonly PtsContext _ptsContext; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LinkUtilities.cs
- DeferredBinaryDeserializerExtension.cs
- securitycriticaldataformultiplegetandset.cs
- CodePrimitiveExpression.cs
- SchemaHelper.cs
- DragEvent.cs
- XmlAnyElementAttribute.cs
- EncodingStreamWrapper.cs
- IISMapPath.cs
- StyleHelper.cs
- BufferedWebEventProvider.cs
- SmiSettersStream.cs
- SubMenuStyleCollection.cs
- HostedHttpContext.cs
- EntityContainer.cs
- httpserverutility.cs
- TableLayoutStyle.cs
- UpdatePanelTriggerCollection.cs
- SystemEvents.cs
- AncestorChangedEventArgs.cs
- BuildProvidersCompiler.cs
- CompiledXpathExpr.cs
- TypeViewSchema.cs
- CustomSignedXml.cs
- Blend.cs
- ViewStateModeByIdAttribute.cs
- IpcChannel.cs
- IteratorFilter.cs
- EventRouteFactory.cs
- sortedlist.cs
- PathStreamGeometryContext.cs
- AssemblyBuilderData.cs
- PackWebResponse.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- HybridDictionary.cs
- BitmapCodecInfo.cs
- ByteAnimationUsingKeyFrames.cs
- HttpConfigurationSystem.cs
- DataGridTable.cs
- SctClaimSerializer.cs
- DataObject.cs
- ToolStripScrollButton.cs
- CodeIndexerExpression.cs
- WindowsBrush.cs
- BitmapEncoder.cs
- TimersDescriptionAttribute.cs
- ManagementEventArgs.cs
- CLSCompliantAttribute.cs
- SequentialUshortCollection.cs
- Directory.cs
- ReadOnlyCollection.cs
- NegotiationTokenAuthenticatorStateCache.cs
- CodePageEncoding.cs
- SafeNativeMethodsOther.cs
- StrokeRenderer.cs
- XmlFormatExtensionAttribute.cs
- ReadOnlyNameValueCollection.cs
- ValidatingCollection.cs
- AsyncSerializedWorker.cs
- JsonClassDataContract.cs
- BamlReader.cs
- LiteralTextParser.cs
- FrameDimension.cs
- WpfSharedBamlSchemaContext.cs
- FilteredXmlReader.cs
- XPathScanner.cs
- ResourcePool.cs
- Emitter.cs
- TextBoxBase.cs
- SqlWriter.cs
- DtdParser.cs
- ZipArchive.cs
- RepeatBehavior.cs
- XmlNamespaceMappingCollection.cs
- ControlValuePropertyAttribute.cs
- XmlObjectSerializerReadContext.cs
- SplitterCancelEvent.cs
- Repeater.cs
- arclist.cs
- SourceInterpreter.cs
- InternalCache.cs
- TextRange.cs
- AccessedThroughPropertyAttribute.cs
- AsyncOperationManager.cs
- TogglePattern.cs
- SessionStateContainer.cs
- PropertyEmitter.cs
- CodeBinaryOperatorExpression.cs
- COM2FontConverter.cs
- CompiledQuery.cs
- UnionCodeGroup.cs
- ConfigurationValidatorBase.cs
- ChameleonKey.cs
- SessionPageStatePersister.cs
- ImageBrush.cs
- StreamSecurityUpgradeProvider.cs
- SynchronizedPool.cs
- UpdatePanel.cs
- GB18030Encoding.cs
- BamlRecords.cs