Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- MetabaseServerConfig.cs
- Int64Storage.cs
- BinaryReader.cs
- SeverityFilter.cs
- DataServiceExpressionVisitor.cs
- ImageBrush.cs
- XhtmlConformanceSection.cs
- VerticalAlignConverter.cs
- SecureEnvironment.cs
- Expressions.cs
- MSG.cs
- ReliableReplySessionChannel.cs
- DesignerDeviceConfig.cs
- ScriptComponentDescriptor.cs
- EditorZoneDesigner.cs
- CapabilitiesSection.cs
- PkcsMisc.cs
- EventMappingSettings.cs
- Int16KeyFrameCollection.cs
- SourceChangedEventArgs.cs
- SingleQueryOperator.cs
- ImpersonateTokenRef.cs
- TemplatedMailWebEventProvider.cs
- BordersPage.cs
- VisualBasic.cs
- EdmMember.cs
- DetailsView.cs
- TreeNodeCollection.cs
- OutOfProcStateClientManager.cs
- OracleCommandBuilder.cs
- TypeBuilderInstantiation.cs
- FontStretch.cs
- WindowVisualStateTracker.cs
- Helpers.cs
- XamlFigureLengthSerializer.cs
- ListParaClient.cs
- KeyedCollection.cs
- TypeSystemProvider.cs
- AsyncResult.cs
- FormViewModeEventArgs.cs
- CategoryAttribute.cs
- DataGridViewUtilities.cs
- KeyValueConfigurationElement.cs
- TextMarkerSource.cs
- CommunicationException.cs
- HtmlTableRow.cs
- Point3DCollectionConverter.cs
- FtpCachePolicyElement.cs
- HGlobalSafeHandle.cs
- XmlDomTextWriter.cs
- HGlobalSafeHandle.cs
- BindingNavigator.cs
- ArgIterator.cs
- CodeMemberField.cs
- HttpServerUtilityWrapper.cs
- EllipseGeometry.cs
- WebPartActionVerb.cs
- Dynamic.cs
- CommandField.cs
- CardSpaceSelector.cs
- BatchServiceHost.cs
- QuaternionAnimation.cs
- MailAddress.cs
- InsufficientMemoryException.cs
- ApplicationFileParser.cs
- ValidatorCompatibilityHelper.cs
- ObjectComplexPropertyMapping.cs
- RequestCacheManager.cs
- ProtocolsSection.cs
- CommonObjectSecurity.cs
- EncoderParameter.cs
- AlphabeticalEnumConverter.cs
- Point3DConverter.cs
- PeerNearMe.cs
- BitmapEffect.cs
- TextParaLineResult.cs
- LineGeometry.cs
- smtpconnection.cs
- designeractionlistschangedeventargs.cs
- AppDomainUnloadedException.cs
- ReadOnlyDataSourceView.cs
- MsdtcClusterUtils.cs
- AgileSafeNativeMemoryHandle.cs
- DateTimeConstantAttribute.cs
- OracleInfoMessageEventArgs.cs
- DiscoveryDocumentSerializer.cs
- ParameterBuilder.cs
- MatrixUtil.cs
- GeneralTransformGroup.cs
- OracleDataReader.cs
- WorkflowOperationBehavior.cs
- StsCommunicationException.cs
- UnmanagedBitmapWrapper.cs
- ExecutionEngineException.cs
- StyleTypedPropertyAttribute.cs
- DataGridViewTopLeftHeaderCell.cs
- CursorConverter.cs
- CompositeScriptReference.cs
- DataMemberFieldConverter.cs
- OrCondition.cs