Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / tx / System / Transactions / SafeIUnknown.cs / 1305376 / SafeIUnknown.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Transactions { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Security.Permissions; // Keep an interface pointer that will not be used in a SafeHandle derived so // that it will be properly released. internal sealed class SafeIUnknown : SafeHandle { // This constructor is called by ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SafeIUnknown() : base(IntPtr.Zero, true) { } // This constructor is called by ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SafeIUnknown(IntPtr unknown) : base(IntPtr.Zero, true) { RuntimeHelpers.PrepareConstrainedRegions(); try {} finally { base.handle = unknown; } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } override protected bool ReleaseHandle() { // NOTE: The SafeHandle class guarantees this will be called exactly once. IntPtr ptr = base.handle; base.handle = IntPtr.Zero; if (IntPtr.Zero != ptr) { Marshal.Release(ptr); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HideDisabledControlAdapter.cs
- StatusCommandUI.cs
- ConditionBrowserDialog.cs
- ListViewTableCell.cs
- InvokeGenerator.cs
- DiscoveryEndpointValidator.cs
- StringExpressionSet.cs
- ContentElementAutomationPeer.cs
- SafeHandle.cs
- JavaScriptObjectDeserializer.cs
- dataprotectionpermissionattribute.cs
- CustomCredentialPolicy.cs
- PathSegmentCollection.cs
- DelimitedListTraceListener.cs
- PreDigestedSignedInfo.cs
- StateMachineWorkflowDesigner.cs
- TogglePatternIdentifiers.cs
- SwitchLevelAttribute.cs
- TraceContextEventArgs.cs
- DatatypeImplementation.cs
- TypedRowGenerator.cs
- XmlAnyAttributeAttribute.cs
- EnlistmentTraceIdentifier.cs
- Crypto.cs
- ComponentEditorPage.cs
- EventWaitHandle.cs
- FreeIndexList.cs
- GPStream.cs
- CodeExporter.cs
- ScriptReferenceEventArgs.cs
- Point3DConverter.cs
- CompilationSection.cs
- HotSpotCollectionEditor.cs
- SystemResources.cs
- Style.cs
- _SSPIWrapper.cs
- BufferedReceiveElement.cs
- NotifyCollectionChangedEventArgs.cs
- RotateTransform.cs
- PipeException.cs
- Base64Encoder.cs
- Composition.cs
- SqlProviderManifest.cs
- DataContext.cs
- XmlSerializerFactory.cs
- ColorContext.cs
- CodeAttributeDeclarationCollection.cs
- ResourceSet.cs
- ReflectionHelper.cs
- PagesChangedEventArgs.cs
- PieceNameHelper.cs
- ImageListUtils.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- TimeoutHelper.cs
- SmtpLoginAuthenticationModule.cs
- QueuePathEditor.cs
- SoapServerProtocol.cs
- DataContext.cs
- PartitionedDataSource.cs
- RoleGroup.cs
- OutArgument.cs
- RequiredAttributeAttribute.cs
- PrimitiveSchema.cs
- ValidatingReaderNodeData.cs
- LateBoundBitmapDecoder.cs
- ColumnMapCopier.cs
- ObjectListFieldsPage.cs
- WebPartEditVerb.cs
- BufferAllocator.cs
- Roles.cs
- DataGridPagerStyle.cs
- CustomErrorCollection.cs
- TextSelectionProcessor.cs
- TextAction.cs
- QualificationDataAttribute.cs
- MultiPropertyDescriptorGridEntry.cs
- Number.cs
- URLBuilder.cs
- HttpException.cs
- SchemaElementDecl.cs
- CatalogZone.cs
- CodeConditionStatement.cs
- SignatureResourceHelper.cs
- EntityDataSourceWrapper.cs
- DataGridViewCellParsingEventArgs.cs
- ProvidePropertyAttribute.cs
- ListControl.cs
- BamlLocalizer.cs
- CLRBindingWorker.cs
- CapiHashAlgorithm.cs
- PointAnimationUsingPath.cs
- MarkupWriter.cs
- HtmlInputFile.cs
- ToolZoneDesigner.cs
- SchemaElementDecl.cs
- ClosureBinding.cs
- AndCondition.cs
- BitmapSourceSafeMILHandle.cs
- UniqueConstraint.cs
- TextUtf8RawTextWriter.cs