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
- SerialPinChanges.cs
- DrawingBrush.cs
- EditorPart.cs
- HiddenField.cs
- Point3D.cs
- ConcurrentBag.cs
- GacUtil.cs
- TitleStyle.cs
- ListBoxItemWrapperAutomationPeer.cs
- AggregateNode.cs
- ToolStripLocationCancelEventArgs.cs
- ConnectionStringsExpressionBuilder.cs
- TriggerAction.cs
- TracingConnection.cs
- MimeTypeMapper.cs
- TextContainerHelper.cs
- RuleElement.cs
- GridViewUpdatedEventArgs.cs
- FunctionMappingTranslator.cs
- GregorianCalendar.cs
- DesignerSerializerAttribute.cs
- HelpFileFileNameEditor.cs
- OleAutBinder.cs
- MetadataWorkspace.cs
- NavigationWindowAutomationPeer.cs
- ChildChangedEventArgs.cs
- BmpBitmapEncoder.cs
- EdmToObjectNamespaceMap.cs
- BufferedWebEventProvider.cs
- GridViewRowCollection.cs
- CodeRegionDirective.cs
- XmlILIndex.cs
- SessionPageStateSection.cs
- BindingListCollectionView.cs
- SwitchLevelAttribute.cs
- DataGridViewRowConverter.cs
- controlskin.cs
- DeviceContext2.cs
- BufferModesCollection.cs
- String.cs
- TextEndOfSegment.cs
- PageSetupDialog.cs
- ServiceDebugBehavior.cs
- ColorAnimationUsingKeyFrames.cs
- KeyPressEvent.cs
- Point3DAnimationUsingKeyFrames.cs
- LineUtil.cs
- FontFamily.cs
- FormsIdentity.cs
- SmiEventSink_Default.cs
- BamlStream.cs
- SerTrace.cs
- ServicesUtilities.cs
- DataGridPagerStyle.cs
- HttpRequestCacheValidator.cs
- WindowsTooltip.cs
- FileSecurity.cs
- XmlWrappingReader.cs
- TraceListeners.cs
- CertificateManager.cs
- TokenBasedSet.cs
- XmlTextReaderImplHelpers.cs
- FaultReason.cs
- EndpointConfigContainer.cs
- LedgerEntryCollection.cs
- ServicePoint.cs
- DataGridViewHitTestInfo.cs
- xdrvalidator.cs
- SourceFileBuildProvider.cs
- PhysicalOps.cs
- MenuItem.cs
- TextDecorations.cs
- ContextMenuStrip.cs
- XPathSingletonIterator.cs
- UserNamePasswordServiceCredential.cs
- XmlValidatingReaderImpl.cs
- ImageCodecInfo.cs
- ItemsPresenter.cs
- ExtensionWindow.cs
- ArithmeticException.cs
- WebPartUtil.cs
- SQLUtility.cs
- MarkupCompiler.cs
- ActivationArguments.cs
- SchemaDeclBase.cs
- ContentOperations.cs
- ThreadPool.cs
- CheckBoxField.cs
- SchemaInfo.cs
- Timeline.cs
- ClientTarget.cs
- InstancePersistenceException.cs
- SecurityDescriptor.cs
- ErrorReporting.cs
- CfgRule.cs
- NavigationProgressEventArgs.cs
- CollectionsUtil.cs
- Roles.cs
- EventPropertyMap.cs
- TokenFactoryCredential.cs