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
- DoubleLink.cs
- BinaryFormatterWriter.cs
- PartialCachingAttribute.cs
- BulletedListEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- ButtonBaseAdapter.cs
- RegexFCD.cs
- UriTemplateQueryValue.cs
- DescendantQuery.cs
- TabControl.cs
- ReadOnlyDataSourceView.cs
- PolicyStatement.cs
- ScriptControlDescriptor.cs
- ResolveNameEventArgs.cs
- TextRangeEditTables.cs
- Vector3D.cs
- NumberFormatter.cs
- TypeDefinition.cs
- Crypto.cs
- PeerResolverMode.cs
- HMACRIPEMD160.cs
- HiddenFieldPageStatePersister.cs
- XmlChoiceIdentifierAttribute.cs
- DiffuseMaterial.cs
- CodeSubDirectory.cs
- DrawingState.cs
- HwndSubclass.cs
- SystemUdpStatistics.cs
- Vector.cs
- ServiceDesigner.xaml.cs
- CircleHotSpot.cs
- WmlListAdapter.cs
- X500Name.cs
- StorageEntityTypeMapping.cs
- ManifestSignedXml.cs
- ReleaseInstanceMode.cs
- DomNameTable.cs
- HandleCollector.cs
- UInt32Converter.cs
- ValueChangedEventManager.cs
- ModelItem.cs
- DllNotFoundException.cs
- GridViewSelectEventArgs.cs
- TableColumnCollection.cs
- KeyPullup.cs
- ModelVisual3D.cs
- DataFieldCollectionEditor.cs
- UserNameSecurityToken.cs
- ClockGroup.cs
- ListViewItemMouseHoverEvent.cs
- HostingEnvironmentException.cs
- ItemChangedEventArgs.cs
- DataGridViewAdvancedBorderStyle.cs
- DataGridViewHitTestInfo.cs
- MsdtcClusterUtils.cs
- DirectoryNotFoundException.cs
- HostingEnvironmentException.cs
- HttpApplication.cs
- DeclarativeCatalogPart.cs
- AttributedMetaModel.cs
- FixedLineResult.cs
- DataListItemCollection.cs
- TableHeaderCell.cs
- XmlBinaryReaderSession.cs
- XmlCharType.cs
- DataTableReader.cs
- PathGradientBrush.cs
- WebCategoryAttribute.cs
- XmlWriterSettings.cs
- CuspData.cs
- RankException.cs
- Storyboard.cs
- ListViewDataItem.cs
- RuleSettingsCollection.cs
- DescendantOverDescendantQuery.cs
- TypePropertyEditor.cs
- SendMailErrorEventArgs.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TextServicesManager.cs
- EncryptedPackage.cs
- WindowsListViewGroupSubsetLink.cs
- BaseProcessor.cs
- ChannelServices.cs
- XmlSchemaAnyAttribute.cs
- IndentTextWriter.cs
- IApplicationTrustManager.cs
- CacheAxisQuery.cs
- CodeCommentStatementCollection.cs
- TreeViewEvent.cs
- BookmarkList.cs
- ProtectedProviderSettings.cs
- ChannelBinding.cs
- XmlBinaryReader.cs
- MiniLockedBorderGlyph.cs
- PageAdapter.cs
- securitycriticaldata.cs
- ClientRequest.cs
- DataGridViewCell.cs
- RuntimeCompatibilityAttribute.cs
- SoapExtensionStream.cs