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
- MessageContractMemberAttribute.cs
- ErrorFormatter.cs
- DataGridRow.cs
- XamlBrushSerializer.cs
- QueryAsyncResult.cs
- DemultiplexingClientMessageFormatter.cs
- Rectangle.cs
- ThreadAttributes.cs
- LiteralText.cs
- DataGridLinkButton.cs
- AutoResizedEvent.cs
- ViewgenContext.cs
- CodeStatement.cs
- ArgIterator.cs
- ThicknessKeyFrameCollection.cs
- XmlAutoDetectWriter.cs
- EdmConstants.cs
- ErrorEventArgs.cs
- MultipleViewPattern.cs
- FormView.cs
- WmiInstallComponent.cs
- Source.cs
- ConditionalAttribute.cs
- DbMetaDataFactory.cs
- LineBreakRecord.cs
- HttpRuntime.cs
- HttpCookie.cs
- XmlStreamStore.cs
- PagesChangedEventArgs.cs
- ProcessModuleCollection.cs
- TakeQueryOptionExpression.cs
- GenericAuthenticationEventArgs.cs
- DecimalFormatter.cs
- DesignerWebPartChrome.cs
- TimelineGroup.cs
- FileStream.cs
- SQLInt32Storage.cs
- AssemblyBuilder.cs
- ErrorProvider.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- EntityDataSourceWrapper.cs
- ArrayWithOffset.cs
- TypeLoadException.cs
- DesignerLoader.cs
- GridEntry.cs
- Hyperlink.cs
- XXXOnTypeBuilderInstantiation.cs
- TreeNodeBinding.cs
- COM2ComponentEditor.cs
- EntitySet.cs
- MetaTableHelper.cs
- ObjectSet.cs
- SemaphoreSecurity.cs
- DictionaryManager.cs
- DefaultParameterValueAttribute.cs
- CacheSection.cs
- SingleObjectCollection.cs
- XomlCompilerHelpers.cs
- TextBlockAutomationPeer.cs
- GetWinFXPath.cs
- ZipIOLocalFileBlock.cs
- TreeViewAutomationPeer.cs
- CqlLexer.cs
- CultureSpecificStringDictionary.cs
- MyContact.cs
- FacetChecker.cs
- OdbcCommandBuilder.cs
- ZipIOLocalFileDataDescriptor.cs
- SiteMapProvider.cs
- documentsequencetextcontainer.cs
- MessageContractImporter.cs
- ExpandCollapseProviderWrapper.cs
- BuildManagerHost.cs
- PathFigureCollectionConverter.cs
- QilChoice.cs
- RetrieveVirtualItemEventArgs.cs
- KnownBoxes.cs
- GeneralTransform.cs
- UncommonField.cs
- AnonymousIdentificationSection.cs
- LinkGrep.cs
- OleDbDataAdapter.cs
- SecurityException.cs
- MouseBinding.cs
- InstanceDataCollectionCollection.cs
- TrackPoint.cs
- ToolStripSeparator.cs
- ColumnMap.cs
- PtsHelper.cs
- PassportAuthenticationEventArgs.cs
- GetKeyedHashRequest.cs
- ListViewGroup.cs
- FixedTextBuilder.cs
- webeventbuffer.cs
- HyperLinkStyle.cs
- VBCodeProvider.cs
- PackagingUtilities.cs
- DesignerSerializerAttribute.cs
- BinaryFormatter.cs
- HttpApplication.cs