Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / 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 : grzegorz - 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. //---------------------------------------------------------------------------- // // 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 : grzegorz - 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
- uribuilder.cs
- Trigger.cs
- DocumentPageView.cs
- DataBinder.cs
- GcSettings.cs
- AutoResetEvent.cs
- DelegateSerializationHolder.cs
- SHA1.cs
- SqlCacheDependency.cs
- CompatibleIComparer.cs
- X509SubjectKeyIdentifierClause.cs
- Int32Rect.cs
- EditorAttribute.cs
- MetadataProperty.cs
- SocketException.cs
- AnonymousIdentificationModule.cs
- DataGridViewHitTestInfo.cs
- TextElement.cs
- EventLogStatus.cs
- SqlConnection.cs
- RbTree.cs
- DataPagerFieldItem.cs
- RangeValidator.cs
- HighlightComponent.cs
- LineServicesCallbacks.cs
- PeerObject.cs
- ProfilePropertyNameValidator.cs
- CrossContextChannel.cs
- ModelPropertyDescriptor.cs
- BindingNavigator.cs
- TypeCodeDomSerializer.cs
- BaseProcessor.cs
- ImmutableClientRuntime.cs
- QilParameter.cs
- Table.cs
- EntityDataSourceSelectingEventArgs.cs
- AuthenticationModuleElementCollection.cs
- OledbConnectionStringbuilder.cs
- BinaryFormatterSinks.cs
- MultiSelectRootGridEntry.cs
- Transactions.cs
- HtmlInputImage.cs
- SafeArrayTypeMismatchException.cs
- ACL.cs
- MultiView.cs
- SessionEndedEventArgs.cs
- SchemaImporterExtensionElement.cs
- PanningMessageFilter.cs
- ExceptionList.cs
- SoapInteropTypes.cs
- XmlTextAttribute.cs
- MissingMemberException.cs
- RegexCaptureCollection.cs
- ReadContentAsBinaryHelper.cs
- BaseCAMarshaler.cs
- PolyLineSegment.cs
- HierarchicalDataBoundControl.cs
- KnownBoxes.cs
- ColorMatrix.cs
- BufferedResponseStream.cs
- RectIndependentAnimationStorage.cs
- CompiledQuery.cs
- AssemblyResourceLoader.cs
- TypedReference.cs
- SRef.cs
- translator.cs
- GrammarBuilderWildcard.cs
- ReflectionTypeLoadException.cs
- DataSourceExpressionCollection.cs
- XamlPointCollectionSerializer.cs
- PathSegmentCollection.cs
- KeyInstance.cs
- BuildProviderAppliesToAttribute.cs
- elementinformation.cs
- Literal.cs
- EventPropertyMap.cs
- hwndwrapper.cs
- GenericRootAutomationPeer.cs
- FrameworkContextData.cs
- ToolboxBitmapAttribute.cs
- Pair.cs
- ResXBuildProvider.cs
- CurrentTimeZone.cs
- UriExt.cs
- UInt64.cs
- WsdlImporter.cs
- DetailsViewRowCollection.cs
- SqlBulkCopyColumnMapping.cs
- AccessDataSourceDesigner.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- IndexedGlyphRun.cs
- StreamWriter.cs
- externdll.cs
- NameObjectCollectionBase.cs
- LogPolicy.cs
- EncoderFallback.cs
- ClickablePoint.cs
- FormViewCommandEventArgs.cs
- PriorityRange.cs
- ResourceCodeDomSerializer.cs