Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / MS / Internal / PtsHost / UnmanagedHandle.cs / 1 / 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; } } ////// 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
- KnownTypeDataContractResolver.cs
- PropertyGrid.cs
- EntryIndex.cs
- DataGridViewTopRowAccessibleObject.cs
- UseManagedPresentationBindingElementImporter.cs
- WindowsStatic.cs
- InfoCardSymmetricAlgorithm.cs
- Shared.cs
- Point.cs
- ListBindingHelper.cs
- ValidatorUtils.cs
- ToolStripItemRenderEventArgs.cs
- EntityReference.cs
- ObjectDataSourceFilteringEventArgs.cs
- TransformerConfigurationWizardBase.cs
- PieceNameHelper.cs
- ClientUrlResolverWrapper.cs
- Triplet.cs
- XmlAttributeAttribute.cs
- UnitySerializationHolder.cs
- PowerStatus.cs
- Pen.cs
- ContractTypeNameCollection.cs
- XPathParser.cs
- ColumnPropertiesGroup.cs
- BodyWriter.cs
- DataObjectCopyingEventArgs.cs
- TemplateKeyConverter.cs
- ContextMenuAutomationPeer.cs
- CompositeDataBoundControl.cs
- DelegateSerializationHolder.cs
- SoapIncludeAttribute.cs
- XmlSchemaElement.cs
- SqlDataSourceStatusEventArgs.cs
- ComponentGuaranteesAttribute.cs
- SqlAggregateChecker.cs
- SafeNativeMethods.cs
- HttpHandlerAction.cs
- GridSplitterAutomationPeer.cs
- AddInEnvironment.cs
- Block.cs
- DesignerAdapterAttribute.cs
- Queue.cs
- DelegatingTypeDescriptionProvider.cs
- ObsoleteAttribute.cs
- CustomValidator.cs
- SynchronizationLockException.cs
- GACIdentityPermission.cs
- OpCodes.cs
- EmptyEnumerator.cs
- NameValueSectionHandler.cs
- FlagsAttribute.cs
- WindowsGrip.cs
- AuthenticatedStream.cs
- ServiceModelConfigurationSectionCollection.cs
- AccessedThroughPropertyAttribute.cs
- KerberosSecurityTokenProvider.cs
- IsolatedStorageFile.cs
- DSACryptoServiceProvider.cs
- ServiceBusyException.cs
- XdrBuilder.cs
- BuildResult.cs
- storepermissionattribute.cs
- HelpProvider.cs
- TextElementEnumerator.cs
- SimplePropertyEntry.cs
- Style.cs
- DoubleAnimationUsingPath.cs
- RowType.cs
- WebPartCollection.cs
- RegexMatch.cs
- Image.cs
- Point4DValueSerializer.cs
- WsdlWriter.cs
- __TransparentProxy.cs
- CacheDependency.cs
- WebReferenceCollection.cs
- BufferAllocator.cs
- ProxyHwnd.cs
- TaiwanCalendar.cs
- ProcessProtocolHandler.cs
- VSWCFServiceContractGenerator.cs
- ImageField.cs
- FragmentQuery.cs
- ModuleConfigurationInfo.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- MethodCallTranslator.cs
- DoubleMinMaxAggregationOperator.cs
- MaskedTextBox.cs
- BulletDecorator.cs
- CDSsyncETWBCLProvider.cs
- BindingContext.cs
- ProxyGenerationError.cs
- StoreAnnotationsMap.cs
- LoginUtil.cs
- DeclarativeExpressionConditionDeclaration.cs
- SoapConverter.cs
- ToolBar.cs
- Mapping.cs
- SoapExtensionReflector.cs